/* ============= CSS Variables & Reset ============= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============= Header & Navigation ============= */
header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-brand i {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-600);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-links a:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-links .btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.lang-switcher select {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-700);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.lang-switcher select:hover {
    border-color: var(--primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 8px;
}

/* ============= Hero Section ============= */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    padding: 80px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 40px;
}

.hero-stat {
    text-align: center;
}

.hero-stat .number {
    font-size: 2rem;
    font-weight: 800;
    display: block;
}

.hero-stat .label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ============= Tools Grid ============= */
.tools-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.section-title {
    text-align: center;
    margin-bottom: 48px;
}

.section-title h2 {
    font-size: 2rem;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.section-title p {
    color: var(--gray-500);
    font-size: 1.1rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.tool-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.tool-card .icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.tool-card .icon i {
    font-size: 1.5rem;
    color: white;
}

.tool-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--gray-900);
}

.tool-card p {
    color: var(--gray-500);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ============= Tool Page ============= */
.tool-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-header h1 {
    font-size: 2rem;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.tool-header p {
    color: var(--gray-500);
    font-size: 1.1rem;
}

.tool-form {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    cursor: pointer;
    transition: var(--transition);
}

.form-group input[type="file"]:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.form-group input[type="password"]:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============= Buttons ============= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============= Upload Area ============= */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-area i {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.upload-area h3 {
    color: var(--gray-700);
    margin-bottom: 8px;
}

.upload-area p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.upload-area .file-types {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.upload-area .file-types span {
    background: var(--gray-200);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* File List */
.file-list {
    margin-top: 16px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--gray-200);
}

.file-item .file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-item .file-info i {
    color: var(--danger);
    font-size: 1.2rem;
}

.file-item .file-name {
    font-weight: 500;
    color: var(--gray-700);
}

.file-item .file-size {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.file-item .remove-file {
    color: var(--danger);
    cursor: pointer;
    padding: 4px 8px;
    border: none;
    background: none;
    font-size: 1.1rem;
}

/* ============= Progress Bar ============= */
.progress-container {
    display: none;
    margin-top: 24px;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-top: 12px;
    color: var(--gray-600);
    font-size: 0.9rem;
}

/* ============= Result Area ============= */
.result-container {
    display: none;
    margin-top: 24px;
    padding: 24px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    text-align: center;
}

.result-container.active {
    display: block;
}

.result-container i {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 16px;
}

.result-container h3 {
    color: var(--success);
    margin-bottom: 8px;
}

.result-container .file-info {
    color: var(--gray-600);
    margin-bottom: 16px;
}

/* ============= Footer ============= */
footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 40px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
}

.footer-section h3 {
    color: white;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.footer-section p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 32px auto 0;
    padding-top: 24px;
    border-top: 1px solid var(--gray-700);
    text-align: center;
    font-size: 0.85rem;
}

/* ============= Messages / Alerts ============= */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ============= Auth Pages ============= */
.auth-page {
    max-width: 420px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-card {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--gray-900);
}

.auth-card .form-group {
    margin-bottom: 20px;
}

.auth-card .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.auth-card .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-card .auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-card .auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.auth-card .auth-links a:hover {
    text-decoration: underline;
}

/* ============= Admin Panel ============= */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.admin-sidebar {
    width: 250px;
    background: var(--gray-900);
    padding: 24px 0;
    flex-shrink: 0;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--gray-400);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-sidebar a i {
    width: 20px;
    text-align: center;
}

.admin-content {
    flex: 1;
    padding: 32px;
    background: var(--gray-50);
}

.admin-header {
    margin-bottom: 32px;
}

.admin-header h1 {
    font-size: 1.8rem;
    color: var(--gray-900);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.stat-card .stat-icon i {
    font-size: 1.3rem;
    color: white;
}

.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* Table */
.table-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table tr:hover {
    background: var(--gray-50);
}

/* ============= Loading Spinner ============= */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============= Responsive Design ============= */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 16px;
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--gray-200);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        padding: 12px 16px;
    }

    .hero {
        padding: 60px 20px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 24px;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .tool-form {
        padding: 24px;
    }

    .admin-sidebar {
        width: 60px;
    }

    .admin-sidebar a span {
        display: none;
    }

    .admin-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 1.6rem;
    }

    .section-title h2 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        padding: 24px;
    }
}

/* ============= Utility Classes ============= */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
