/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #475569;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --background: #0f172a;
    --card-background: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --input-background: #0f172a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--card-background);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.login-box h2 {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: 400;
}

/* Navbar */
.navbar {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-user {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-actions {
    display: flex;
    gap: 12px;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 18px;
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.icon {
    font-size: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: var(--input-background);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
}

.alert-floating.show {
    opacity: 1;
    transform: translateY(0);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.category-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.category-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.category-header h3 {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

.category-actions {
    display: flex;
    gap: 4px;
}

.category-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.category-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.image-count {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    background: var(--card-background);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

/* Images Grid */
.selection-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--card-background);
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

#selectedCount {
    color: var(--text-secondary);
    font-size: 14px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.image-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
}

.image-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.image-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
}

.image-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    background: white;
    border-radius: 4px;
}

.image-link {
    display: block;
    position: relative;
    padding-top: 75%; /* 4:3 aspect ratio */
    background: var(--background);
}

.image-link img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-info {
    padding: 16px;
}

.image-name {
    font-weight: 500;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.image-meta {
    display: flex;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 12px;
}

.image-actions {
    display: flex;
    gap: 8px;
}

/* Users Table */
.users-table {
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.users-table table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 16px;
    text-align: left;
}

.users-table th {
    background: var(--input-background);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}

.users-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-background);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close:hover {
    background: rgba(99, 102, 241, 0.1);
}

.modal-content form {
    padding: 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
}

/* Upload Progress */
.upload-progress {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

#progressText {
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Coming Soon Page */
.coming-soon-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 80px 20px 40px;
}

.coming-soon-container {
    width: 100%;
    max-width: 700px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coming-soon-content {
    background: var(--card-background);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-color);
}

.coming-soon-logo {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.coming-soon-title {
    font-size: 36px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.coming-soon-text {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.coming-soon-features {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.feature-icon {
    font-size: 36px;
}

.feature-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
}

/* Floating Admin Button */
.floating-admin-btn {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(30, 41, 59, 0.95);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.floating-admin-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.4);
}

/* Small Modal for Login */
.modal-small {
    max-width: 400px;
}

.modal-small form {
    padding: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 16px;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .nav-menu .btn {
        width: 100%;
        justify-content: center;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
    }

    .categories-grid,
    .images-grid {
        grid-template-columns: 1fr;
    }

    .users-table {
        overflow-x: auto;
    }

    .coming-soon-content {
        padding: 40px 20px;
    }

    .coming-soon-logo {
        font-size: 32px;
    }

    .coming-soon-title {
        font-size: 24px;
    }

    .coming-soon-text {
        font-size: 16px;
    }

    .coming-soon-features {
        flex-direction: column;
        gap: 24px;
    }

    .floating-admin-btn {
        top: 16px;
        right: 16px;
        padding: 10px 20px;
        font-size: 13px;
    }

    .modal-content {
        max-width: 95%;
        margin: 0 10px;
    }

    .selection-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .image-actions {
        flex-direction: column;
        width: 100%;
    }

    .image-actions .btn {
        width: 100%;
    }

    .category-actions {
        flex-wrap: wrap;
    }

    /* Make buttons more touch-friendly on mobile */
    .btn {
        min-height: 44px;
    }

    .btn-icon {
        padding: 12px;
    }
}

/* Extra small devices (phones in portrait, less than 576px) */
@media (max-width: 576px) {
    .container {
        padding: 20px 16px;
    }

    .coming-soon-logo {
        font-size: 28px;
    }

    .coming-soon-title {
        font-size: 20px;
    }

    .coming-soon-text {
        font-size: 14px;
    }

    .feature-icon {
        font-size: 28px;
    }

    .feature-text {
        font-size: 12px;
    }

    .floating-admin-btn {
        top: 12px;
        right: 12px;
        left: 12px;
        text-align: center;
        padding: 10px 16px;
    }

    .page-header h2 {
        font-size: 24px;
    }

    .modal-header h3 {
        font-size: 18px;
    }
}

