/* Donna Portal - Shared Styles */

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

:root {
    --primary: #2196F3;
    --primary-light: #BBDEFB;
    --primary-dark: #1976D2;
    --phone-color: #2196F3;
    --whatsapp-color: #25D366;
    --text: #333;
    --text-light: #666;
    --text-muted: #888;
    --bg: #f5f5f5;
    --bg-white: #fff;
    --border: #ddd;
    --border-light: #eee;
    --success: #4CAF50;
    --error: #f44336;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ==================== Login Page ==================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow: hidden;
}

/* ==================== Animated Gradient Background ==================== */

.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.gradient-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.7;
}

.shape-1 {
    width: 800px;
    height: 800px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    top: -30%;
    left: -20%;
    animation: float 12s ease-in-out infinite;
}

.shape-2 {
    width: 700px;
    height: 700px;
    background: linear-gradient(135deg, #00BCD4 0%, #0097A7 100%);
    top: 40%;
    right: -25%;
    animation: float2 15s ease-in-out infinite;
}

.shape-3 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #673AB7 0%, #512DA8 100%);
    bottom: -20%;
    left: 20%;
    animation: float3 18s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(200px, -100px) scale(1.1);
    }
    50% {
        transform: translate(350px, 50px) scale(1.05);
    }
    75% {
        transform: translate(150px, -80px) scale(0.95);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes float2 {
    0% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-250px, 80px) scale(1.1);
    }
    50% {
        transform: translate(-400px, -50px) scale(0.9);
    }
    75% {
        transform: translate(-180px, 100px) scale(1.05);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes float3 {
    0% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(180px, 120px) scale(1.1);
    }
    50% {
        transform: translate(-200px, 80px) scale(0.95);
    }
    75% {
        transform: translate(-300px, -60px) scale(1.05);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-light);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.success-message {
    text-align: center;
    padding: 20px;
}

.success-icon {
    width: 60px;
    height: 60px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.success-message h2 {
    color: var(--success);
    margin-bottom: 8px;
}

.success-message .small {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 12px;
}

.error-message {
    background: #ffebee;
    color: var(--error);
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* ==================== Dashboard Layout ==================== */

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header h1 {
    font-size: 20px;
    color: var(--primary);
}

.company-name {
    font-size: 18px;
    color: var(--text);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.logout-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
}

.logout-btn:hover {
    background: var(--bg);
    color: var(--text);
}

/* ==================== Tab Navigation ==================== */

.tabs {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    gap: 0;
}

.tab {
    padding: 16px 24px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

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

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

/* ==================== Content Area ==================== */

.content {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
    font-size: 18px;
    color: var(--text);
}

/* ==================== Data Display ==================== */

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.data-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

.data-value {
    font-size: 16px;
    color: var(--text);
}

.data-value.large {
    font-size: 24px;
    font-weight: 600;
}

.data-value.primary {
    color: var(--primary);
}

/* ==================== Stats Cards ==================== */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 600;
}

.stat-card.cost .value { color: #9C27B0; }
.stat-card.phone .value { color: var(--phone-color); }
.stat-card.whatsapp .value { color: var(--whatsapp-color); }
.stat-card.conversations .value { color: var(--primary); }

/* ==================== Form Edit Mode ==================== */

.edit-form {
    display: none;
}

.edit-form.active {
    display: block;
}

.view-mode.hidden {
    display: none;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ==================== Team Members Table ==================== */

.team-table {
    width: 100%;
    border-collapse: collapse;
}

.team-table th,
.team-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.team-table th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

.team-table tr:hover {
    background: var(--bg);
}

.team-table .badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.team-actions {
    display: flex;
    gap: 8px;
}

.team-actions button {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==================== Month Selector ==================== */

.month-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.month-selector label {
    font-weight: 500;
    color: var(--text-secondary);
}

.month-selector select {
    padding: 10px 16px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-white);
    min-width: 180px;
    cursor: pointer;
}

.month-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* ==================== Chart Container ==================== */

.chart-container {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.chart-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-group {
    display: flex;
    gap: 16px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-white);
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.toggle.active {
    border-color: currentColor;
}

.toggle input {
    display: none;
}

.toggle-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.toggle-cost { color: #9C27B0; }
.toggle-cost .toggle-indicator { background: #9C27B0; }
.toggle-phone { color: var(--phone-color); }
.toggle-phone .toggle-indicator { background: var(--phone-color); }
.toggle-whatsapp { color: var(--whatsapp-color); }
.toggle-whatsapp .toggle-indicator { background: var(--whatsapp-color); }

/* ==================== Loading States ==================== */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== Hamburger Menu ==================== */

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile navigation overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.mobile-nav-overlay.active {
    display: block;
}

/* ==================== Responsive Tables ==================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    /* Header mobile */
    .header {
        flex-direction: row;
        justify-content: space-between;
        padding: 12px 16px;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .header h1 {
        font-size: 16px;
    }

    .company-name {
        font-size: 14px;
    }

    .header-right {
        gap: 8px;
    }

    .user-email {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    /* Mobile tabs navigation */
    .tabs {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        background: var(--bg-white);
        padding: 80px 0 24px;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        transition: right 0.3s ease;
        overflow-y: auto;
    }

    .tabs.active {
        right: 0;
    }

    .tab {
        padding: 16px 24px;
        border-bottom: none;
        border-left: 3px solid transparent;
        margin-bottom: 0;
    }

    .tab.active {
        border-bottom: none;
        border-left-color: var(--primary);
        background: var(--bg);
    }

    /* Content area mobile */
    .content {
        padding: 16px;
    }

    .section {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    /* Form mobile */
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Month selector mobile */
    .month-selector {
        padding: 12px 16px;
        margin-bottom: 16px;
    }

    .month-selector select {
        flex: 1;
        min-width: 0;
    }

    /* Stats cards mobile */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .value {
        font-size: 22px;
    }

    .stat-card h3 {
        font-size: 10px;
    }

    /* Chart controls mobile */
    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toggle-group {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .toggle {
        padding: 6px 10px;
        font-size: 14px;
    }

    .chart-container {
        padding: 16px;
    }

    /* Make chart taller on mobile */
    #usageChart {
        min-height: 300px !important;
    }

    /* Table mobile */
    .team-table,
    .conversations-table {
        font-size: 13px;
    }

    .team-table th,
    .team-table td,
    .conversations-table th,
    .conversations-table td {
        padding: 10px 8px;
    }

    .team-actions {
        flex-direction: column;
        gap: 4px;
    }

    .team-actions button {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* Data grid mobile */
    .data-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Modal mobile */
    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    /* Badge mobile */
    .badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .header h1 {
        font-size: 14px;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .login-card {
        padding: 24px;
    }

    .login-header h1 {
        font-size: 22px;
    }
}
