/**
 * Link Manager - Modern Responsive Stylesheet
 * Optimized for Desktop, Tablet, and Mobile
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Work+Sans:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
    --primary-bg: #1a1a2e;
    --secondary-bg: #16213e;
    --accent-bg: #0f3460;
    --primary-color: #00d9ff;
    --secondary-color: #0099cc;
    --text-primary: #e4e4e4;
    --text-secondary: #a0a0a0;
    --border-color: rgba(0, 217, 255, 0.3);
    --error-color: #ff3b30;
    --success-color: #34c759;
    --font-main: 'Work Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --transition: all 0.3s ease;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.3);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== Authentication Pages ===== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: var(--accent-bg);
    padding: 50px;
    border-radius: var(--radius-lg);
    max-width: 450px;
    width: 100%;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 10px;
    text-shadow: var(--shadow-glow);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 0.95rem;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.auth-tab:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--primary-color);
}

.auth-tab.active {
    background: var(--primary-color);
    color: var(--primary-bg);
    border-color: var(--primary-color);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.form-input::placeholder {
    color: #666;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-bg);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--primary-color);
}

.btn-logout {
    padding: 10px 20px;
    background: rgba(255, 59, 48, 0.2);
    border: 2px solid var(--error-color);
    border-radius: var(--radius-md);
    color: var(--error-color);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
}

.btn-logout:hover {
    background: var(--error-color);
    color: white;
}

.btn-add {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-bg);
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.95rem;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 217, 255, 0.4);
}

.btn-icon {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.btn-icon:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--primary-color);
}

.btn-delete {
    border-color: rgba(255, 59, 48, 0.5);
    color: var(--error-color);
}

.btn-delete:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--error-color);
}

/* ===== Alerts ===== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-error {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.alert-success {
    background: rgba(52, 199, 89, 0.15);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.feature-note {
    background: rgba(0, 217, 255, 0.1);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-top: 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ===== Main App ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.app-title {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--primary-color);
    margin-bottom: 5px;
    text-shadow: var(--shadow-glow);
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-bg);
    font-family: var(--font-mono);
}

.username {
    font-weight: 500;
}

/* ===== Directory Tabs ===== */
.directory-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 10px;
}

.directory-tab {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.9rem;
}

.directory-tab:hover {
    border-color: var(--primary-color);
    background: rgba(0, 217, 255, 0.1);
}

.directory-tab.active {
    background: var(--primary-color);
    color: var(--primary-bg);
    border-color: var(--primary-color);
}

.directory-tab.new {
    border-style: dashed;
    color: var(--primary-color);
}

/* ===== Search & Add Bar ===== */
.search-add-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.search-input::placeholder {
    color: #666;
}

/* ===== Table ===== */
.table-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    border: 1px solid rgba(0, 217, 255, 0.1);
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

thead {
    background: rgba(0, 217, 255, 0.1);
}

th {
    padding: 16px;
    text-align: left;
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9rem;
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:hover {
    background: rgba(0, 217, 255, 0.05);
}

.table-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    word-break: break-all;
}

.table-link:hover {
    text-decoration: underline;
    color: #00eaff;
}

.table-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--secondary-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.modal-title {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-buttons .btn-secondary,
.modal-buttons .btn-primary {
    flex: 1;
}

/* ===== Toggle Switch ===== */
.share-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 217, 255, 0.05);
    border-radius: var(--radius-md);
}

.toggle-switch {
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-switch.active {
    background: var(--primary-color);
}

.toggle-slider {
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-switch.active .toggle-slider {
    left: 26px;
}

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state-text {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .auth-box {
        padding: 30px 25px;
    }
    
    .app-container {
        padding: 20px 15px;
    }
    
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-add-bar {
        flex-direction: column;
    }
    
    .search-input,
    .btn-add {
        width: 100%;
    }
    
    .modal-content {
        padding: 25px;
    }
    
    .table-container {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }
    
    th, td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }
    
    .table-actions {
        flex-direction: column;
    }
    
    .btn-icon {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-title {
        font-size: 1.5rem;
    }
    
    .app-title {
        font-size: 1.3rem;
    }
    
    .directory-tabs {
        gap: 8px;
    }
    
    .directory-tab {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* ===== Utilities ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
