/* === AERO SYSTEM STYLESHEET === */

/* --- Variables and Basic Setup --- */
:root {
    --primary-color: #0052cc;
    --primary-light: #e9f2ff;
    --secondary-color: #f4f5f7;
    --background-color: #fafbfe;
    --text-color: #172b4d;
    --light-text-color: #5e6c84;
    --border-color: #dfe1e6;
    --success-color: #00875a;
    --success-light: #e6fffa;
    --error-color: #de350b;
    --error-light: #ffebe6;
    --info-color: #0065ff;
    --info-light: #deebff;
    --white: #ffffff;
    --shadow: 0 4px 12px rgba(23, 43, 77, 0.08);
    --shadow-hover: 0 6px 16px rgba(23, 43, 77, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

p {
    line-height: 1.6;
    color: var(--light-text-color);
}

/* --- Main Header / Navigation --- */
.main-header {
    background-color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.main-header nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.main-header nav a {
    text-decoration: none;
    color: var(--light-text-color);
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.main-header nav a:hover {
    color: var(--primary-color);
}

.main-header nav a.logout-btn {
    background-color: var(--error-light);
    color: var(--error-color);
    padding: 8px 16px;
    border-radius: 6px;
    border-bottom: none;
}

.main-header nav a.logout-btn:hover {
    background-color: var(--error-color);
    color: var(--white);
}

/* --- Main Content Area and Containers --- */
.main-content-area {
    flex-grow: 1;
}

.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
}

.login-container {
    max-width: 420px;
    margin: 5rem auto;
    padding: 2.5rem;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

/* --- Forms & Buttons --- */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--light-text-color);
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    background-color: #f9fafb;
    transition: all 0.3s;
    font-family: 'Poppins', sans-serif;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.2);
}
.form-link {
    display: block;
    margin-top: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}
.form-link:hover { text-decoration: underline; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-align: center;
    gap: 8px;
}
.btn:hover { background-color: #0041a3; transform: translateY(-2px); }
.btn:disabled { background-color: #a5adba; cursor: not-allowed; transform: none; }
.btn-secondary { background-color: var(--secondary-color); color: var(--text-color); }
.btn-secondary:hover { background-color: #e2e4e8; }
.btn-danger { background-color: var(--error-color); }
.btn-danger:hover { background-color: #bf2600; }

/* --- Dashboard Specific Styles --- */
.request-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}
.result-area {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--primary-light);
    border: 1px dashed var(--primary-color);
    border-radius: 12px;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    word-break: break-all;
}
#email-result { font-size: 1.3rem; font-weight: 600; color: var(--success-color); letter-spacing: 0.5px; }
.copy-btn {
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
    background: var(--white); border: 1px solid var(--border-color);
    border-radius: 6px; cursor: pointer; font-size: 0.8rem;
    color: var(--light-text-color); display: none; padding: 6px 10px;
    font-weight: 600;
}
.copy-btn:hover { color: var(--primary-color); border-color: var(--primary-color); }

.recent-activity { background: var(--white); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow); }
#recent-emails-list { list-style: none; }
#recent-emails-list li {
    padding: 12px 15px; border-radius: 8px; margin-bottom: 10px;
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    background-color: var(--secondary-color);
    animation: fadeIn 0.5s ease;
}
#recent-emails-list li .email-addr { font-family: monospace; font-weight: 500; word-break: break-all; margin-right: 15px; }
#recent-emails-list li .badge {
    background-color: var(--info-light); color: var(--info-color);
    padding: 4px 8px; border-radius: 4px; font-size: 0.8rem;
    font-weight: 500; margin-right: 15px;
}
#recent-emails-list li .time { font-size: 0.8rem; color: var(--light-text-color); flex-shrink: 0; }
#recent-emails-list .no-emails { animation: none; justify-content: center; color: var(--light-text-color); }

/* --- Profile Page & API --- */
.profile-section { background: var(--white); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 2rem; }
.api-key-box { display: flex; gap: 10px; margin-top: 1rem; }
.api-key-box input { background-color: var(--secondary-color); font-family: monospace; }
.api-key-box button { width: auto; flex-shrink: 0; padding: 12px 20px; }
.api-docs { margin-top: 2rem; background: #2d3748; color: var(--white); padding: 1.5rem; border-radius: 8px; }
.api-docs h4 { color: var(--white); }
.api-docs code { display: block; background: #1a202c; padding: 1rem; border-radius: 6px; margin-top: 1rem; font-family: monospace; white-space: pre-wrap; word-break: break-all; }

/* --- Admin Panel --- */
.stats-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background-color: var(--white); padding: 1.5rem; border-radius: 12px; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); }
.stat-card .icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background-color: var(--primary-light); color: var(--primary-color); }
.stat-card .info h3 { font-size: 2rem; color: var(--primary-color); margin: 0; line-height: 1; }
.stat-card .info p { color: var(--light-text-color); margin: 0; font-size: 0.9rem; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.action-card { display: block; background: var(--white); padding: 2rem; border-radius: 12px; box-shadow: var(--shadow); text-decoration: none; font-size: 1.2rem; font-weight: 600; text-align: center; color: var(--primary-color); transition: transform 0.2s, box-shadow 0.2s; }
.action-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.chart-container { background: var(--white); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow); }

/* --- Alerts & Notifications --- */
.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; border: 1px solid transparent; }
.alert-success { background-color: var(--success-light); color: var(--success-color); border-color: #a3e9d3; }
.alert-danger { background-color: var(--error-light); color: var(--error-color); border-color: #fdd8d2; }
#notification-container { position: fixed; top: 80px; right: 20px; z-index: 1000; width: 320px; }
.notification {
    padding: 15px 20px; border-radius: 8px; margin-bottom: 10px; color: var(--white);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15); opacity: 0;
    transform: translateX(120%); transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.notification.show { opacity: 1; transform: translateX(0); }
.notification.success { background-color: var(--success-color); }
.notification.error { background-color: var(--error-color); }
.notification.info { background-color: var(--info-color); }

/* --- Footer --- */
.site-footer { text-align: center; padding: 2rem; margin-top: auto; color: var(--light-text-color); font-size: 0.9rem; width: 100%; }

/* --- Animations & Utilities --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.spinner-border { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; border: .2em solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spinner-border .75s linear infinite; }
@keyframes spinner-border { to { transform: rotate(360deg); } }


/* --- Added for User Dashboard Stats --- */
.dashboard-stats {
    display: flex;
    gap: 2rem;
    background-color: var(--primary-light);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}
.stat-item {
    font-size: 1rem;
}
.stat-item .stat-label {
    color: var(--light-text-color);
    font-weight: 500;
}
.stat-item .stat-value {
    color: var(--primary-color);
    font-weight: 600;
}






/* --- Table Styles for Admin Panel --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}
.admin-table th, .admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.admin-table th {
    background-color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--light-text-color);
}
.admin-table tr:hover {
    background-color: var(--secondary-color);
}
.admin-table td .badge { /* Re-using badge style */
    padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 500;
}
.admin-table td .badge.role-admin { background-color: var(--error-light); color: var(--error-color); }
.admin-table td .badge.role-manager { background-color: #fff0b3; color: #997400; }
.admin-table td .badge.role-user { background-color: var(--info-light); color: var(--info-color); }
.admin-table td .badge.status-active { background-color: var(--success-light); color: var(--success-color); }
.admin-table td .badge.status-disabled { background-color: #ddd; color: #555; }
.admin-table .actions { display: flex; gap: 10px; }
.admin-table .actions .btn, .admin-table .actions select {
    width: auto;
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* --- Pagination Styles --- */
.pagination {
    margin-top: 2rem;
    text-align: center;
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary-color);
    background-color: var(--white);
    border: 1px solid var(--border-color);
}
.pagination a:hover {
    background-color: var(--primary-light);
}
.pagination span.current {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    font-weight: 600;
}
.pagination span.disabled {
    color: #ccc;
    cursor: not-allowed;
}




/* --- Added for New User Dashboard Stats Grid --- */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .dashboard-stats-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.stats-card-main, .stats-card-user {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.stats-card-main h3, .stats-card-user h3 {
    margin-top: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

#category-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.category-stat-item {
    background: var(--secondary-color);
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-stat-item .name {
    font-weight: 600;
    color: var(--text-color);
}

.category-stat-item .count {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.user-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--secondary-color);
}
.user-stat-item:last-child {
    border-bottom: none;
}
.user-stat-item .label {
    color: var(--light-text-color);
    font-weight: 500;
}
.user-stat-item .value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--success-color);
}

.loader {
    text-align: center;
    color: var(--light-text-color);
    padding: 1rem;
}