/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

header p {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 400;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Login Form */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    min-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-box h2 {
    margin-bottom: 2rem;
    color: var(--gray-900);
    font-size: 1.875rem;
    font-weight: 700;
}

#passwordForm {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#passwordInput {
    padding: 1rem 1.25rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--white);
    color: var(--gray-900);
}

#passwordInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

button {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Main App */
.main-app {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Controls */
.controls {
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.search-container {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    min-width: 300px;
}

#searchInput {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
    transition: all 0.2s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#clearSearch {
    padding: 0.875rem 1.5rem;
    background: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

.filter-container {
    display: flex;
    gap: 0.75rem;
}

select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--white);
    color: var(--gray-700);
    transition: all 0.2s ease;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Stats */
.stats {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%);
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

/* Table */
.table-container {
    overflow-x: auto;
    background: var(--white);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1.5rem 2rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

th {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    font-weight: 600;
    color: var(--gray-700);
    position: sticky;
    top: 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Title column */
.title-cell {
    max-width: 250px;
}

.title-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-block;
}

.title-link:hover {
    color: var(--primary-dark);
    transform: translateX(2px);
}

/* Summary column */
.summary-cell {
    max-width: 400px;
    line-height: 1.6;
    color: var(--gray-600);
}

/* Tags */
.tags-cell {
    max-width: 200px;
}

.tag {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.125rem;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.tag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Date */
.date-cell {
    white-space: nowrap;
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Actions */
.actions-cell {
    white-space: nowrap;
}

.btn-delete {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.btn-delete:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 2rem;
    opacity: 0.8;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: var(--gray-700);
    font-size: 1.5rem;
    font-weight: 700;
}

.empty-state p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    color: var(--gray-600);
}

.shortcut-info {
    margin-top: 3rem;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.shortcut-info h4 {
    margin-bottom: 1.5rem;
    color: var(--gray-800);
    font-size: 1.25rem;
    font-weight: 600;
}

.shortcut-info ol {
    padding-left: 1.5rem;
    color: var(--gray-600);
}

.shortcut-info li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
    box-shadow: var(--shadow-md);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--white);
    margin: 15% auto;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
}

.modal-content h3 {
    color: var(--gray-800);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--gray-600);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gray-500) 0%, var(--gray-600) 100%);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Error Message */
.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 1rem;
    display: none;
    font-weight: 500;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    header p {
        font-size: 1.125rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .search-container {
        min-width: auto;
    }
    
    .filter-container {
        justify-content: space-between;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 1rem;
    }
    
    .title-cell, .summary-cell {
        max-width: 200px;
    }
    
    .summary-cell {
        font-size: 0.875rem;
    }
    
    .login-box {
        min-width: auto;
        margin: 1rem;
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .login-box {
        margin: 0.75rem;
        padding: 1.5rem;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .controls {
        padding: 1.5rem;
    }
    
    th, td {
        padding: 0.75rem;
    }
}
