:root {
    --bg-color: #000000;
    --card-bg: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent-color: rgba(138, 255, 49, 0.9);
    --button-text: #000000;
    --nav-bg: #1c1c1d;
    --nav-border: #38383a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding-bottom: 90px; /* Increased space for bigger nav */
}

/* Container Padding Fix */
.container-relative {
    position: relative;
    width: 100%;
    padding: 0 10px 100px 10px; /* Reduced side padding for wider look */
    max-width: 600px;
    margin: 0 auto;
}

#home-content {
    padding-top: 80px; /* Top padding for Home tab to clear header */
}

#generate-content {
    padding-top: 10px; /* Small top padding for Generate tab form */
}

/* Typography & Basics */
h1, h2, h3 {
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

/* --- BUTTONS --- */
.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    background-color: var(--accent-color);
    color: var(--button-text);
    border: none;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    display: block;
    text-align: center;
}

.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-primary:disabled {
    background-color: #3a3a3c;
    color: #8e8e93;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background-color: var(--card-bg);
    color: var(--accent-color);
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    display: block;
    text-align: center;
}

.btn-small {
    padding: 6px 12px;
    border-radius: 8px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 10px;
}

/* --- INPUTS --- */
input[type="text"], textarea, select {
    width: 100%;
    background-color: var(--card-bg);
    border: none;
    border-radius: 12px;
    padding: 14px;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 10px;
    outline: none;
}

input::placeholder, textarea::placeholder {
    color: var(--text-secondary);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Select Wrapper */
.select-wrapper {
    position: relative;
}
.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 45px;
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background-color: var(--card-bg);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.segmented-option {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.segmented-option.active {
    background-color: #636366;
    color: white;
}

/* Toggle */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--card-bg);
    padding: 14px;
    border-radius: 12px;
}

.toggle-label {
    font-size: 16px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a3a3c;
    transition: .4s;
    border-radius: 30px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--accent-color);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* --- NAVIGATION --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    display: flex;
    justify-content: space-around;
    padding: 16px 0 34px 0; /* Significantly increased padding */
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #8e8e93;
    font-size: 13px; /* Larger text */
    cursor: pointer;
    width: 80px; /* Larger touch area */
}

.nav-item.active {
    color: var(--accent-color);
}

.nav-icon {
    font-size: 32px; /* Much larger icons */
    margin-bottom: 6px;
}

/* Tabs */
.tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- HOME TAB --- */
.hero {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

.hero-chart-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

.hero-chart {
    width: 100%;
    height: 180px;
    position: relative;
}

.hero-refresh {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stats Cards */
.stats-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

.stat-card-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

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

.stat-card-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-card-spark {
    height: 30px;
    margin-top: 5px;
}

/* Calendar & Daily Idea */
.calendar-section {
    margin-top: 20px;
    margin-bottom: 20px;
}

.calendar-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.calendar-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 15px;
    scrollbar-width: none;
}
.calendar-scroll::-webkit-scrollbar {
    display: none;
}

.calendar-day {
    min-width: 50px;
    height: 70px;
    background: var(--card-bg);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.calendar-day.active {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(249, 61, 13, 0.3);
}

.day-name {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.day-number {
    font-size: 18px;
    font-weight: 700;
}

/* Daily Idea Card */
.daily-idea-card {
    background: linear-gradient(135deg, #2c2c2e 0%, #3a3a3c 100%);
    border-radius: 16px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
}

.daily-idea-card:active {
    transform: scale(0.98);
}

.daily-idea-card::before {
    content: "✨";
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 60px;
    opacity: 0.05;
    transform: rotate(15deg);
}

.idea-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    font-weight: 700;
    margin-bottom: 8px;
}

.idea-content {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 12px;
    font-weight: 500;
}

.idea-action {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Tips Card */
.health-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.tips-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.tips-content.blur {
    filter: blur(4px);
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
}

.premium-lock {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    z-index: 5;
    color: white;
}

.premium-lock i {
    font-size: 24px;
    margin-bottom: 10px;
    color: #FFD700;
}

/* --- CREATE TAB --- */
.header-with-action {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 60px; /* Safe area from top */
    width: 100%;
}

.header-with-action h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Input Groups */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: #8e8e93;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding-left: 4px;
}

/* Inputs */
textarea, select {
    width: 100%;
    background-color: #1c1c1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    color: white;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    resize: none;
    transition: all 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

textarea:focus, select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(138, 255, 49, 0.1);
    background-color: #2c2c2e;
}

/* Custom Select Arrow */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "\f078"; /* FontAwesome chevron-down */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 16px;
    top: 42px; /* Adjust based on label height + padding */
    color: #8e8e93;
    pointer-events: none;
    font-size: 14px;
}

/* Tone Selector */
.tone-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tone-chip {
    padding: 12px 20px;
    background: #1c1c1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-grow: 1;
    text-align: center;
    user-select: none;
}

.tone-chip:active {
    transform: scale(0.96);
}

.tone-chip.active {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(138, 255, 49, 0.2);
}

/* Segmented Control (Size) */
.segmented-control {
    display: flex;
    background: #1c1c1e;
    padding: 4px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.segmented-option {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-size: 14px;
    color: #8e8e93;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    font-weight: 500;
}

.segmented-option.active {
    background: var(--accent-color);
    color: #000;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Toggle Row */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 4px 4px 4px 4px; /* Minimal padding, alignment with labels */
}

.settings-row span {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

/* Generate Button Enhancements */
.btn-primary {
    background: var(--accent-color);
    color: #000;
    font-weight: 700;
    font-size: 17px;
    padding: 18px;
    border-radius: 20px;
    width: 100%;
    border: none;
    box-shadow: 0 8px 24px rgba(138, 255, 49, 0.25);
    transition: all 0.2s;
    cursor: pointer;
    text-align: center;
    letter-spacing: -0.3px;
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px rgba(138, 255, 49, 0.15);
}

/* Variants */
.variants-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.variant-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.variant-card.selected {
    border-color: var(--accent-color);
    background-color: rgba(138, 255, 49, 0.1);
}

.variant-header {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--accent-color);
    font-size: 14px;
    text-transform: uppercase;
}

.variant-text {
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
}

/* Preview */
.post-preview {
    background-color: #ffffff; /* Telegram Light Mode simulation */
    color: #000000;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
}

.preview-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.preview-avatar {
    width: 36px;
    height: 36px;
    background: #ccc;
    border-radius: 50%;
    margin-right: 10px;
}

.preview-name {
    font-weight: 600;
    font-size: 15px;
}

.preview-content {
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* --- PROFILE TAB --- */
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    text-align: center;
}

.profile-hero-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 3px solid var(--accent-color);
    object-fit: cover;
    background-color: #333;
}

.profile-hero-name {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 5px;
}

.status-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    display: inline-block;
}

.status-badge.free {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
}

.status-badge.premium {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
}

.limit-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin-bottom: 8px;
    overflow: hidden;
}

.limit-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
}

/* Referral Banner */
.referral-banner {
    background: linear-gradient(135deg, #8AFF31 0%, #6BCA26 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 8px 20px rgba(138, 255, 49, 0.3);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.referral-banner::after {
    content: "🎁";
    position: absolute;
    right: 10px;
    bottom: -10px;
    font-size: 80px;
    opacity: 0.2;
    transform: rotate(-15deg);
}

.referral-title {
    font-size: 18px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 4px;
}

.referral-desc {
    font-size: 14px;
    color: rgba(0,0,0,0.8);
}

/* List/Menu Section */
.list-section {
    margin-bottom: 20px;
}

.list-section-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-left: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.list-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
}

.list-item {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
}

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

.list-item:active {
    background: rgba(255,255,255,0.05);
}

.list-icon {
    width: 24px;
    text-align: center;
    margin-right: 12px;
    font-size: 18px;
    color: var(--accent-color);
}

.list-text {
    flex: 1;
    font-size: 16px;
}

.list-chevron {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- MODALS --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 350px;
    border-radius: 20px;
    padding: 24px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.close-icon-btn {
    background: rgba(255,255,255,0.1);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

.modal-handle {
    width: 40px;
    height: 5px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    margin: 0 auto 15px auto;
}

.close-btn {
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
}

/* History Modal Specifics */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    border: 1px solid transparent;
}

/* --- ONBOARDING --- */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.onboarding-content {
    width: 90%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 24px;
    padding: 30px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.onboarding-slide {
    display: none;
    animation: fadeIn 0.3s ease;
}

.onboarding-slide.active {
    display: block;
}

.slide-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.slide-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.slide-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.dot.active {
    background: var(--accent-color);
    width: 20px;
    border-radius: 4px;
}

/* Skeleton Loading */
.skeleton {
    display: inline-block;
    height: 1em;
    width: 100%;
    background: linear-gradient(90deg, #3a3a3c 25%, #48484a 50%, #3a3a3c 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

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

/* Blur Effect */
.blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.blur-text {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: white;
}

.history-btn {
    font-size: 24px;
    cursor: pointer;
}
