/* ============================================
   DASHBOARD STYLES
   ============================================ */

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-title {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
}

.dashboard-cta {
    background: white;
    color: #667eea;
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #6B7280;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #1a202c;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dashboard-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

/* Make generator forms flex-grow to fill space and align buttons */
.generators-grid .dashboard-card .generator-form {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.generators-grid .dashboard-card .generator-form form {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Push generate buttons to bottom */
.generators-grid .dashboard-card .generate-button {
    margin-top: auto;
}

/* Analytics Section Spacing */
.analytics-section {
    margin-bottom: 3rem !important;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Button Improvements */
.generate-button,
.generate-btn {
    transition: all 0.3s ease;
}

.generate-button:hover:not(:disabled),
.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.generate-button:disabled,
.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Chart containers */
.analytics-charts-grid > div {
    transition: transform 0.2s ease;
}

.analytics-charts-grid > div:hover {
    transform: translateY(-2px);
}

.recent-hooks-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1.5rem;
}

/* Subscription Card */
.subscription-plan {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.plan-badge {
    color: white;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 0.5rem;
}

.plan-price {
    color: rgba(255, 255, 255, 0.95);
    font-size: 28px;
    font-weight: 800;
}

.subscription-details {
    margin-bottom: 1.5rem;
}

.detail-text {
    color: #4A5A7A;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.subscription-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-upgrade {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border-radius: 10px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-cancel {
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 400;
    font-size: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: #4F46E5;
    opacity: 0.9;
}

.btn-cancel:hover {
    background: #fcc;
}

/* History List */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.history-item:last-child {
    border-bottom: none;
}

.history-info {
    flex: 1;
}

.history-desc {
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 0.25rem;
}

.history-date {
    font-size: 13px;
    color: #6B7280;
}

.history-amount {
    font-weight: 700;
    font-size: 16px;
}

.history-amount.positive {
    color: #10b981;
}

.history-amount.negative {
    color: #ef4444;
}

/* Hooks List */
.hooks-list {
    display: grid;
    gap: 1rem;
}

.hook-item {
    padding: 1.25rem;
    border: 2px solid #f3f4f6;
    border-radius: 12px;
    transition: all 0.2s;
}

.hook-item:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.hook-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.hook-date {
    font-size: 13px;
    color: #6B7280;
    font-weight: 600;
}

.hook-topic {
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.75rem;
}

.hook-texts {
    display: grid;
    gap: 0.5rem;
}

.hook-text {
    font-size: 14px;
    color: #4A5A7A;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #6B7280;
    font-size: 15px;
}

.empty-state a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Analytics and Generator Grids */
.analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.generators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.form-row-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.stats-row-responsive {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 1024px) {
    .generators-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1.5rem 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .analytics-charts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .generators-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-row-responsive {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-row-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .dashboard-card {
        padding: 1.5rem;
    }

    .card-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .dashboard-title {
        font-size: 24px;
    }

    .dashboard-subtitle {
        font-size: 14px;
    }
}

/* ============================================
   SIDE NAVIGATION (NEW)
   ============================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.side-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(102, 126, 234, 0.1);
    padding: 2rem 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.side-nav-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    margin-bottom: 1rem;
}

.side-nav-logo {
    font-size: 20px;
    font-weight: 800;
    color: #667eea;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.side-nav-menu {
    padding: 0 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    color: #4A5A7A;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-item.active:hover {
    transform: translateX(0);
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(102, 126, 234, 0.1);
    margin: 1rem 0;
}

.side-nav-footer {
    padding: 0 1rem;
    margin-top: 2rem;
}

/* Main content area with sidebar */
.main-content {
    margin-left: 240px;
    width: calc(100% - 240px);
    min-height: 100vh;
}

/* Hide top navbar on authenticated pages with side nav */
.has-side-nav .navbar {
    display: none;
}

/* Mobile hamburger for side nav */
.side-nav-toggle {
    display: none;
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 101;
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.side-nav-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: #667eea;
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .side-nav {
        transform: translateX(-100%);
    }

    .side-nav.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .side-nav-toggle {
        display: block;
    }

    /* Overlay when menu is open */
    .side-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        display: none;
    }

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

/* Adjust dashboard container for side nav layout */
.has-side-nav .dashboard-container {
    padding-top: 2rem;
}
