/* =============================================== */
/* === GLOBAL STYLES & BRAND VARIABLES       === */
/* =============================================== */
:root {
    --primary-brand-color: #004d40; /* Deep Teal */
    --accent-brand-color: #ffc107;  /* Amber-Gold */
    --accent-hover-color: #fca903;  /* A slightly darker gold for hover */
    --font-family: 'Inter', sans-serif;
    --card-bg-color: #ffffff;
    --body-bg-color: #f7f7f8;
    --text-color: #212529;
    --muted-text-color: #6c757d;
}

body, html { 
    height: 100%; 
    margin: 0; 
    font-family: var(--font-family);
    background-color: var(--body-bg-color);
}

/* === NEW LOADER STYLES === */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}
.loader-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-brand-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* === END OF LOADER STYLES === */

.card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}


/* =============================================== */
/* === LOGIN / SIGNUP PAGE STYLES            === */
/* =============================================== */
.split-container { display: flex; height: 100vh; }
.left-panel { flex: 2; background-color: var(--primary-brand-color); color: white; display: flex; flex-direction: column; justify-content: center; padding: 3rem 4rem; }
.left-panel h1 { color: white; font-weight: 700; font-size: 2.75rem; margin-bottom: 4rem; line-height: 1.2; }
.left-panel .benefit { display: flex; align-items: center; margin-bottom: 2rem; font-size: 1.1rem; }
.left-panel .benefit-icon { font-size: 1.2rem; margin-right: 1.25rem; }
.right-panel { flex: 3; display: flex; justify-content: center; align-items: center; padding: 2rem; }
.auth-card { background-color: var(--card-bg-color); padding: 3rem; border-radius: 0.75rem; box-shadow: 0 8px 30px rgba(0,0,0,0.08); width: 100%; max-width: 450px; border: 1px solid #e9ecef; }
.google-btn { background-color: white; color: #444; border: 1px solid #ddd; width: 100%; text-align: center; margin-bottom: 1.5rem; padding: 0.75rem; font-weight: 700; }
.google-btn img { height: 1.2em; vertical-align: middle; margin-right: 0.75em;}
.auth-card button[type="submit"] { 
    width: 100%;
    background-color: var(--accent-brand-color);
    border-color: var(--accent-brand-color);
    font-weight: 700;
    padding: 0.75rem;
}
.auth-card button[type="submit"]:hover { 
    background-color: var(--accent-hover-color);
    border-color: var(--accent-hover-color);
}
.separator { text-align: center; margin: 2rem 0; color: #aaa; }
.auth-card p { text-align: center; margin-top: 1.5rem; color: var(--muted-text-color); }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; font-weight: 700; color: var(--muted-text-color); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.75rem; border: 1px solid #ced4da; border-radius: 0.25rem; font-size: 1rem; box-sizing: border-box; }
.alert { padding: 1rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: 0.25rem; }
.alert-success { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.alert-error { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }

/* =============================================== */
/* === LOGGED-IN APP LAYOUT STYLES           === */
/* =============================================== */
.app-container { display: flex; }
.sidebar { width: 250px; background-color: var(--primary-brand-color); color: #ffffff; height: 100vh; padding: 1.5rem; position: fixed; top: 0; left: 0; display: flex; flex-direction: column; }
.sidebar .logo { font-weight: 700; font-size: 1.4rem; margin-bottom: 2.5rem; padding: 0 0.5rem; display: flex; align-items: center; gap: 0.75rem; }
.sidebar .logo-icon { background-color: var(--accent-brand-color); width: 32px; height: 32px; border-radius: 6px; -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2.003 20.25a2.25 2.25 0 0 0 2.244 2.243h15.506a2.25 2.25 0 0 0 2.244-2.243V3.75a2.25 2.25 0 0 0-2.244-2.243H4.247A2.25 2.25 0 0 0 2.003 3.75v16.5ZM4.247 3.003h15.506c.414 0 .75.336.75.747v2.483l-8.503 5.424a.75.75 0 0 1-.798 0L3.503 6.233V3.75c0-.41.336-.747.744-.747Zm15.506 17.24H4.247a.75.75 0 0 1-.744-.747V8.503l7.98 5.094a2.25 2.25 0 0 0 2.394 0l7.98-5.094v11.003c0 .41-.336.747-.744-.747Z"/></svg>') center/60% no-repeat; mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2.003 20.25a2.25 2.25 0 0 0 2.244 2.243h15.506a2.25 2.25 0 0 0 2.244-2.243V3.75a2.25 2.25 0 0 0-2.244-2.243H4.247A2.25 2.25 0 0 0 2.003 3.75v16.5ZM4.247 3.003h15.506c.414 0 .75.336.75.747v2.483l-8.503 5.424a.75.75 0 0 1-.798 0L3.503 6.233V3.75c0-.41.336-.747.744-.747Zm15.506 17.24H4.247a.75.75 0 0 1-.744-.747V8.503l7.98 5.094a2.25 2.25 0 0 0 2.394 0l7.98-5.094v11.003c0 .41-.336.747-.744-.747Z"/></svg>') center/60% no-repeat; }
.sidebar nav { flex-grow: 1; }
.sidebar nav a { display: flex; align-items: center; color: #a9b4c2; text-decoration: none; padding: 0.75rem 1rem; border-radius: 0.375rem; margin-bottom: 0.5rem; font-weight: 500; transition: background-color 0.2s, color 0.2s; }
.sidebar nav a .nav-icon { width: 20px; height: 20px; margin-right: 1rem; filter: invert(80%) sepia(11%) saturate(301%) hue-rotate(176deg) brightness(91%) contrast(88%); }
.sidebar nav a:hover { color: #ffffff; }
.sidebar nav a.active { background-color: #006a5a; color: #ffffff; font-weight: 700; }
.sidebar nav a.active .nav-icon { filter: invert(100%); }
.main-content { margin-left: 250px; padding: 2.5rem 3.5rem; width: calc(100% - 250px); }
.page-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 2rem; 
}
.page-header h1 { font-size: 2.25rem; font-weight: 700; margin: 0; color: var(--primary-brand-color); }
.btn-primary, .btn-accent { 
    color: #ffffff; 
    border: none; 
    padding: 0.75rem 1.5rem; 
    border-radius: 0.375rem; 
    font-weight: 700; 
    text-decoration: none; 
    cursor: pointer; 
    transition: background-color 0.2s; 
}
.btn-primary { background-color: var(--primary-brand-color); }
.btn-primary:hover { background-color: #006a5a; }
.btn-accent { background-color: var(--accent-brand-color); color: #212529; }
.btn-accent:hover { background-color: var(--accent-hover-color); }
.btn-secondary { background-color: #e9ecef; color: var(--text-color); border: 1px solid #ced4da; padding: 0.75rem 1.5rem; border-radius: 0.375rem; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color 0.2s; }
.btn-secondary:hover { background-color: #dee2e6; }

/* =============================================== */
/* === DASHBOARD & REPORT PAGE STYLES        === */
/* =============================================== */
.table-card { padding: 0; }
table { width: 100%; border-collapse: collapse; margin: 0; border: none; box-shadow: none; }
table th, table td { padding: 1.25rem 1.5rem; text-align: left; border-bottom: 1px solid #e9ecef; }
table th { color: #6c757d; text-transform: uppercase; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; }
table tbody tr:last-child td { border-bottom: none; }
.clickable-row:hover { cursor: pointer; background-color: #f8f9fa; }
a.campaign-link { display: block; text-decoration: none; color: inherit; }
.opens-data { display: flex; flex-direction: column; line-height: 1.2; }
.opens-data .percentage { color: #6c757d; font-size: 0.9rem; }
.status-pill { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 1rem; font-weight: 500; font-size: 0.8rem; text-transform: capitalize; }
.status-active { background-color: #d1e7dd; color: #0f5132; }
.status-completed { background-color: #d1e7dd; color: #0f5132; }
.status-draft { background-color: #e2e3e5; color: #41464b; }
.status-scheduled { background-color: #fff3cd; color: #664d03; }
.empty-state-card { text-align: center; padding: 5rem; margin-top: 2rem; border: 1px dashed #ced4da; background-color: #fdfdff; box-shadow: none; }
.empty-state-card img { width: 80px; margin-bottom: 2rem; }
.empty-state-card h2 { font-weight: 700; }
.empty-state-card p { color: #6c757d; max-width: 400px; margin: 1rem auto; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { padding: 1.5rem; }
.stat-card .stat-value { font-size: 2.25rem; font-weight: 700; color: var(--text-color); line-height: 1.1; }
.stat-card .stat-label { font-size: 0.9rem; color: var(--muted-text-color); margin-top: 0.25rem; }
.status-opened { background-color: #cfe2ff; color: #0a58ca; }
.status-clicked { background-color: #d1e7dd; color: #0f5132; }
.status-bounced { background-color: #f8d7da; color: #842029; }
.status-sent { background-color: #e2e3e5; color: #41464b; }

/* =============================================== */
/* === CAMPAIGN COMPOSER STYLES              === */
/* =============================================== */
.composer-card { padding: 2.5rem; }
.sheet-disconnected-state { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border: 1px solid #e9ecef; border-radius: 0.375rem; background-color: #f8f9fa; }
.sheet-disconnected-state .status-text { color: var(--muted-text-color); padding-left: 0.5rem; }
.sheet-disconnected-state .connect-button { background-color: #e9ecef; color: var(--text-color); padding: 0.5rem 1rem; border-radius: 0.25rem; text-decoration: none; font-weight: 500; transition: background-color 0.2s; white-space: nowrap; }
.sheet-disconnected-state .connect-button:hover { background-color: #dee2e6; }
.sheet-connected-state { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; border: 1px solid #badbcc; border-radius: 0.375rem; background-color: #f0fdf4; }
.sheet-connected-state img { width: 24px; height: 24px; }
.sheet-details { flex-grow: 1; }
.sheet-details strong { font-weight: 700; color: var(--text-color); }
.sheet-details span { color: var(--muted-text-color); font-size: 0.9rem; display: block; }
a.change-link { font-size: 0.9rem; font-weight: 700; color: #553c9a; text-decoration: none; }
a.change-link:hover { text-decoration: underline; }
.placeholder-container { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.placeholder-btn { background-color: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; padding: 0.25rem 0.75rem; border-radius: 0.25rem; font-family: 'Courier New', Courier, monospace; font-size: 0.9rem; cursor: pointer; transition: background-color 0.2s; }
.placeholder-btn:hover { background-color: #e2e8f0; }

/* =============================================== */
/* === SETTINGS PAGE STYLES                  === */
/* =============================================== */
.settings-container { display: flex; gap: 2rem; }
.settings-nav { flex: 0 0 200px; }
.settings-nav-link { display: block; padding: 0.75rem 1rem; text-decoration: none; color: var(--muted-text-color); font-weight: 500; border-radius: 0.375rem; margin-bottom: 0.5rem; }
.settings-nav-link.active { background-color: #e9ecef; color: var(--text-color); font-weight: 700; }
.settings-nav-link:not(.active):hover { background-color: #f8f9fa; }
.settings-content { flex-grow: 1; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid #e9ecef; font-size: 1.25rem; font-weight: 700; }
.card-body { padding: 1.5rem; }
.profile-layout { display: flex; gap: 2rem; align-items: flex-start; }
.profile-fields { flex-grow: 1; }
.profile-avatar { text-align: center; }
.profile-avatar img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin-bottom: 1rem; border: 2px solid #e9ecef; }
.profile-avatar .btn-secondary { width: 100%; }
.form-actions { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #e9ecef; text-align: right; }
.account-item { display: flex; align-items: center; padding: 1rem 0; }
.account-item img { width: 32px; height: 32px; margin-right: 1rem; }
.account-item div { flex-grow: 1; }
.account-item div strong { display: block; font-weight: 700; }
.account-item div span { color: var(--muted-text-color); font-size: 0.9rem; }
.btn-danger { background-color: #fee2e2; color: #b91c1c; border: 1px solid #f5c2c7; font-weight: 500; padding: 0.5rem 1rem; border-radius: 0.25rem; cursor: pointer; }
.plan-name { color: var(--primary-brand-color); font-weight: 700; }
.settings-feature-list { list-style: none; padding: 0; margin-top: 1.5rem; }
.settings-feature-list li { margin-bottom: 0.75rem; font-size: 1.1rem; }

/* === DELETE BUTTON STYLES === */
.btn-delete { background-color: transparent; border: 1px solid #dc3545; color: #dc3545; padding: 0.25rem 0.75rem; border-radius: 0.25rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease-in-out; }
.btn-delete:hover { background-color: #dc3545; color: #fff; }

/* =============================================== */
/* === PHASE 4: UPGRADE & TEAM SETTINGS STYLES === */
/* =============================================== */
.upgrade-page-container {
    display: grid;
    grid-template-columns: 3fr 2fr; /* 60% features, 40% form */
    gap: 3rem;
    align-items: start;
}

.features-column .pricing-box {
    background-color: #f0fdf4;
    border: 1px solid #a7f3d0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 2rem 0;
}
.pricing-box .original-price {
    font-size: 1.2rem;
    color: var(--muted-text-color);
    margin-right: 0.75rem;
}
.pricing-box .final-price {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-brand-color);
}
.pricing-box .coupon-notice {
    margin: 0.5rem 0 0;
    font-weight: 500;
    color: #059669;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.feature-list .feature-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #dcfce7;
    color: #16a34a;
    font-weight: bold;
}
.feature-list p {
    margin: 0.25rem 0 0;
    color: var(--muted-text-color);
    line-height: 1.5;
}

.form-column .card {
    position: sticky; /* Make the form stick on scroll */
    top: 2.5rem;
}
.form-group input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
    font-weight: 500;
    color: var(--muted-text-color);
}
.terms-text {
    font-size: 0.8rem;
    color: var(--muted-text-color);
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 0;
}
.terms-text a {
    color: var(--primary-brand-color);
    font-weight: 500;
}

/* Trial Status Card Styles for Team Settings */
.trial-status-card {
    background: linear-gradient(135deg, #004d40, #00796b);
    color: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}
.trial-status-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.trial-status-header .status-indicator {
    width: 12px;
    height: 12px;
    background-color: #4ade80; /* Bright green */
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
}
.trial-status-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}
.trial-days-left {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}
.trial-days-left span {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
}
.trial-progress-bar {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}
.trial-progress-bar-inner {
    height: 100%;
    background-color: var(--accent-brand-color);
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 992px) {
    .upgrade-page-container {
        grid-template-columns: 1fr; /* Stack columns */
    }
}

/* =============================================== */
/* === PHASE 7.5: ROLES & PERMISSIONS UI STYLES === */
/* =============================================== */

/* Tab Navigation */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 2rem;
}
.tab-link {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--muted-text-color);
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* Overlaps the container border */
}
.tab-link.active {
    color: var(--primary-brand-color);
    font-weight: 700;
    border-bottom-color: var(--primary-brand-color);
}
.tab-link:not(.active):hover {
    color: var(--text-color);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Role Pill for non-admins */
.role-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    background-color: #e9ecef;
    color: #495057;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Roles Management Layout */
.roles-management-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}
.role-list-column .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}
.role-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.role-list-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    font-weight: 500;
}
.role-list-item:last-child {
    border-bottom: none;
}
.role-list-item:hover {
    background-color: #f8f9fa;
}
.role-list-item.active {
    background-color: #e2e3fe;
    color: #4338ca;
    font-weight: 700;
}

/* Permission Editor Styles */
#permission-editor-placeholder {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--muted-text-color);
}
.permission-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.permission-checkbox {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    cursor: pointer;
}
.permission-checkbox input[type="checkbox"] {
    width: 1.25em;
    height: 1.25em;
    margin-right: 0.75rem;
}
.card-footer {
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: right;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--muted-text-color);
    background: none;
    border: none;
    cursor: pointer;
}

/* Final additions for Wing Head UI */
.role-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.assign-members-list {
    max-height: 40vh; /* Make the list scrollable if there are many members */
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.5rem;
}