/* Mr.Loto - Main Styles */

:root {
    --primary: #1e3a5f;
    --primary-dark: #152d4a;
    --primary-light: #2b6cb0;
    --secondary: #0d9488;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #27ae60;
    --info: #3498db;
    --dark: #1e293b;
    --gray: #64748b;
    --light-gray: #94a3b8;
    --lighter: #e2e8f0;
    --white: #ffffff;
    --bg: #f1f5f9;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --radius: 8px;
    --sidebar-width: 260px;
    --sidebar-mini: 60px;
    --topbar-height: 50px;
    --sidebar-bg: #152d4a;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(255,255,255,0.14);
    --sidebar-transition: 0.25s ease;
}

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

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

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(30,58,95,0.18);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.12);
}

.topbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.topbar-user {
    color: rgba(255,255,255,0.85);
}

.topbar-right .btn-outline {
    border-color: rgba(255,255,255,0.5);
    color: rgba(255,255,255,0.9);
}

.topbar-right .btn-outline:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.8);
    color: var(--white);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 150;
    transition: width var(--sidebar-transition), transform var(--sidebar-transition);
    padding: 8px 0;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.35);
    padding: 16px 20px 6px;
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    border-right: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--white);
    border-right-color: var(--secondary);
}

.sidebar-link.locked {
    opacity: 0.4;
    pointer-events: none;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-text {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sidebar-lock {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Sidebar collapsed (desktop) */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-mini);
}

body.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .sidebar-lock,
body.sidebar-collapsed .sidebar-section-title {
    display: none;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 10px 0;
    border-right: none;
}

body.sidebar-collapsed .content-wrapper {
    margin-left: var(--sidebar-mini);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 140;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

/* Content wrapper */
.content-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
    transition: margin-left var(--sidebar-transition);
}

/* Content Tabs (horizontal tab bar inside content area) */
.content-tabs {
    display: flex;
    gap: 0;
    background: var(--white);
    border-bottom: 2px solid var(--lighter);
    padding: 0 24px;
    overflow: visible;
    white-space: nowrap;
    position: relative;
    z-index: 50;
}

.tab-link {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

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

.tab-link.locked {
    opacity: 0.4;
    pointer-events: none;
}

.tab-lock-icon {
    width: 12px;
    height: 12px;
    opacity: 0.5;
}

/* Tab groups with dropdowns */
.tab-group {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}

.tab-group-toggle {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

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

.tab-group.has-active > .tab-group-toggle {
    color: var(--primary);
    border-bottom-color: var(--secondary);
}

.tab-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
    opacity: 0.5;
}

.tab-group.open > .tab-group-toggle .tab-chevron {
    transform: rotate(180deg);
}

.tab-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--lighter);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 180px;
    padding: 4px 0;
    z-index: 100;
}

.tab-group.open > .tab-dropdown {
    display: block;
}

.tab-dropdown .tab-link {
    display: flex;
    padding: 9px 16px;
    border-bottom: none;
    margin-bottom: 0;
    white-space: nowrap;
    font-size: 13px;
    border-radius: 0;
}

.tab-dropdown .tab-link:hover {
    background: var(--lightest, #f8fafc);
}

.tab-dropdown .tab-link.active {
    color: var(--secondary);
    border-bottom: none;
    background: rgba(13, 148, 136, 0.06);
    font-weight: 700;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--lighter);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--gray);
    font-size: 12px;
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.inline-form .form-row .form-group {
    flex: 1;
}

/* Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gray);
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

.plan-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 8px;
}

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

/* Plans */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.plan-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.plan-card:hover {
    border-color: var(--primary);
}

.plan-current {
    border-color: var(--secondary);
}

.plan-price {
    margin: 16px 0;
}

.plan-price .price {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.plan-price .period {
    color: var(--gray);
}

.plan-features {
    list-style: none;
    text-align: left;
    margin: 24px 0;
}

.plan-features li {
    padding: 8px 0;
    border-bottom: 1px solid var(--lighter);
    font-size: 14px;
}

.plan-features li.disabled {
    color: var(--light-gray);
    text-decoration: line-through;
}

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

.stat {
    text-align: center;
    padding: 12px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--lighter);
}

/* Number frequency */
.number-freq-list {
    margin-top: 12px;
}

.freq-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.freq-bar {
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    flex: 1;
    max-width: 200px;
}

.freq-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    min-width: 80px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--gray);
}

/* Checkout */
.checkout-container {
    max-width: 500px;
    margin: 0 auto;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--lighter);
}

.summary-row.total {
    font-weight: 700;
    font-size: 18px;
    border-bottom: none;
}

.payment-note {
    background: #fff3cd;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin: 16px 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--gray);
    font-size: 14px;
    margin-top: 48px;
}

/* Responsive */
@media (max-width: 768px) {
    .two-column { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .plans-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }

    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
    }

    body.sidebar-collapsed .content-wrapper {
        margin-left: 0;
    }

    .content-tabs {
        padding: 0 12px;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .content-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-link {
        padding: 10px 12px;
        font-size: 12px;
    }

    .tab-group-toggle {
        padding: 10px 12px;
        font-size: 12px;
    }

    .tab-dropdown {
        min-width: 160px;
    }

    .topbar-user {
        display: none;
    }
}
