/* assets/css/style.css */
/* Стили для сервиса коротких ссылок altli.ru */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #ca8a04;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.main-header, .admin-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.main-header h1 a, .admin-header h1 {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.5rem;
}

.main-nav, .admin-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.main-nav a, .admin-nav a {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.main-nav a:hover, .admin-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-logout { color: var(--danger) !important; }
.nav-logout:hover { background: #fef2f2 !important; }

.user-greeting {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 2rem 0;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Forms */
.shorten-form, .auth-form, .settings-form {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 1rem 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="datetime-local"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

small {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn:active {
    transform: translateY(1px);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-secondary {
    background: #64748b;
}
.btn-secondary:hover { background: #475569; }

.btn-danger {
    background: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    border-left: 4px solid;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #166534;
}

.alert-error {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

/* Result */
.result {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    border: 2px solid var(--primary);
}

.result a {
    color: var(--primary);
    word-break: break-all;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 1rem 0;
}

.links-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.links-table th,
.links-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.links-table th {
    background: #f1f5f9;
    font-weight: 600;
    white-space: nowrap;
}

.links-table tr:hover {
    background: #f8fafc;
}

.links-table tr:last-child td {
    border-bottom: none;
}

.code-cell { font-family: monospace; font-weight: 500; }
.short-code { color: var(--primary); text-decoration: none; }
.short-code:hover { text-decoration: underline; }

.url-cell {
    max-width: 300px;
}

.link-title {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.long-url {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}
.long-url:hover { color: var(--primary); }

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.actions-cell { white-space: nowrap; }

.empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}
.empty a { color: var(--primary); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.page-link {
    color: var(--primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.page-link:hover {
    background: var(--primary-light);
}

.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Search */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}
.search-form input {
    flex: 1;
    min-width: 200px;
}

/* API docs */
.api-docs, .features {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.api-docs pre, .settings-section pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.api-docs code, .settings-section code {
    font-family: 'Fira Code', 'Consolas', monospace;
}

.features ul {
    list-style: none;
    padding-left: 0;
}
.features li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}
.features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* Footer */
.main-footer, .admin-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
}

.main-footer a, .admin-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Auth page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-container {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-container h1 {
    margin-bottom: 0.5rem;
}

.auth-container .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.auth-footer {
    margin-top: 1.5rem;
}
.auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Settings */
.settings-section {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    box-shadow: var(--shadow);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.help-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .main-nav, .admin-nav {
        justify-content: center;
    }
    
    .links-table {
        font-size: 0.85rem;
    }
    
    .links-table td:nth-child(2),
    .links-table th:nth-child(2) {
        display: none;
    }
    
    .pagination {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .shorten-form, .auth-form {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.875rem 1.5rem;
    }
}

/* Print */
@media print {
    .main-header, .admin-header, footer, .shorten-form-section, .api-docs {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .links-table {
        font-size: 0.8rem;
    }
}

.row-expired { opacity: 0.8; background: #fef2f2 !important; }
.row-warning { background: #fffbeb !important; }