/* ========================================
   GLOBAL STYLES
   ======================================== */

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

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --text-dark: #1a202c;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

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

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ========================================
   AUTH PAGE (index.html)
   ======================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    animation: gradientMove 15s ease infinite;
    position: relative;
    overflow: hidden;
}

.bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: float 6s ease-in-out infinite;
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 450px;
    padding: 20px;
    animation: slideUp 0.6s ease;
}

.auth-card {
    background: var(--white);
    border-radius: 25px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

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

.auth-section {
    display: none;
}

.auth-section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.auth-section h2 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.reset-info {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ========================================
   FORMS
   ======================================== */

.auth-form, .form-group {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    width: 100%;
    padding: 14px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* ========================================
   MESSAGES
   ======================================== */

.error-message,
.success-message {
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    display: none;
}

.error-message {
    background: #fee2e2;
    color: var(--error);
    border: 2px solid var(--error);
}

.success-message {
    background: #d1fae5;
    color: var(--success);
    border: 2px solid var(--success);
}

.error-message.active,
.success-message.active {
    display: block;
    animation: slideUp 0.3s ease;
}

/* ========================================
   AUTH LINKS
   ======================================== */

.auth-links {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ========================================
   NAVBAR
   ======================================== */

.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-user span {
    color: var(--text-dark);
    font-weight: 600;
}

/* ========================================
   DASHBOARD PAGE
   ======================================== */

.dashboard-page,
.admin-page {
    min-height: 100vh;
    background: var(--bg-light);
}

.dashboard-container,
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.dashboard-header,
.admin-header {
    margin-bottom: 40px;
}

.dashboard-header h1,
.admin-header h1 {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
}

/* ========================================
   TOOLS GRID
   ======================================== */

.tools-section {
    margin-bottom: 60px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.tool-card {
    background: var(--white);
    border-radius: 15px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.tool-card h3 {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.tool-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ========================================
   REQUESTS
   ======================================== */

.requests-section {
    margin-top: 40px;
}

.requests-list,
.admin-requests-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.request-card {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.request-card h3 {
    color: var(--text-dark);
    font-size: 1.2rem;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fef3c7;
    color: var(--warning);
}

.status-approved {
    background: #d1fae5;
    color: var(--success);
}

.status-rejected {
    background: #fee2e2;
    color: var(--error);
}

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

.request-info strong {
    color: var(--text-dark);
}

.request-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* ========================================
   ADMIN PANEL
   ======================================== */

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.search-input {
    width: 100%;
    max-width: 300px;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
}

/* ========================================
   USERS TABLE
   ======================================== */

.users-table {
    background: var(--white);
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.user-row {
    display: grid;
    grid-template-columns: 1fr 2fr 150px 120px 150px;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
    transition: background 0.2s ease;
}

.user-row:hover {
    background: var(--bg-light);
}

.user-row:last-child {
    border-bottom: none;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
}

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

.user-uid {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-light);
}

.verified-badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.verified-yes {
    background: #d1fae5;
    color: var(--success);
}

.verified-no {
    background: #fee2e2;
    color: var(--error);
}

/* ========================================
   MODAL
   ======================================== */

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.4s ease;
}

.modal-content h2 {
    color: var(--text-dark);
    margin-bottom: 20px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-dark);
}

.permissions-section {
    margin: 20px 0;
}

.permissions-section h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.permission-item {
    padding: 12px;
    margin: 10px 0;
    background: var(--bg-light);
    border-radius: 8px;
}

.permission-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.permission-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

/* ========================================
   LOADING
   ======================================== */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-style: italic;
}

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

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

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .auth-card {
        padding: 30px 20px;
    }
    
    .dashboard-header h1,
    .admin-header h1 {
        font-size: 2rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .user-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .nav-user {
        flex-direction: column;
        gap: 10px;
    }
    
    .auth-links {
        flex-direction: column;
        gap: 10px;
    }
}