/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --background: #ffffff;
    --foreground: #171717;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --red-50: #fef2f2;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --green-100: #dcfce7;
    --green-600: #16a34a;
    --orange-100: #ffedd5;
    --orange-600: #ea580c;
    --purple-200: #e9d5ff;
    --purple-600: #9333ea;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    line-height: 1.5;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.5; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.animate-fadeIn {
    animation: fadeIn 0.2s ease-out forwards;
}

.animate-slideUp {
    animation: slideUp 0.3s ease-out;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Container */
.container-mobile {
    max-width: 672px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gray-600);
    transition: color 0.2s;
}

.header-btn:hover {
    color: var(--gray-900);
}

.header-btn.primary {
    color: var(--blue-500);
}

.header-btn.primary:hover {
    color: var(--blue-600);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    z-index: 50;
}

.bottom-nav-inner {
    max-width: 672px;
    margin: 0 auto;
    padding: 0 1rem;
}

.bottom-nav-list {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 4rem;
    list-style: none;
}

.bottom-nav-item {
    flex: 1;
    height: 100%;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: var(--gray-500);
    transition: color 0.2s;
}

.bottom-nav-link:hover {
    color: var(--gray-900);
}

.bottom-nav-link.active {
    color: var(--blue-600);
}

.bottom-nav-link svg {
    width: 1.5rem;
    height: 1.5rem;
    margin-bottom: 0.25rem;
}

.bottom-nav-link span {
    font-size: 0.75rem;
}

.bottom-nav-link.active span {
    font-weight: 500;
}

/* Cards */
.card-white {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-100);
}

/* Sort Options */
.sort-options {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.sort-options-list {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.sort-btn {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
}

.sort-btn:hover {
    background: var(--gray-100);
}

.sort-btn.active {
    background: var(--blue-500);
    color: white;
    border-color: var(--blue-500);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-overlay.center {
    align-items: center;
}

/* Modal Content */
.modal-content {
    background: white;
    border-radius: 1rem 1rem 0 0;
    width: 100%;
    max-width: 28rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.center {
    border-radius: 1rem;
}

.modal-header {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 1rem 1rem 0 0;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.75rem;
    font-size: 1rem;
    color: var(--gray-900);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: none;
    min-height: 10rem;
}

.form-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    text-align: right;
}

/* Time Select Row */
.time-select-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.time-select-row .form-select {
    flex: 1;
}

.time-separator {
    color: var(--gray-500);
}

/* Day Selector Grid */
.day-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.day-btn {
    padding: 0.75rem 0;
    border-radius: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: var(--gray-100);
    color: var(--gray-900);
}

.day-btn:hover {
    background: var(--gray-200);
}

.day-btn.active {
    background: var(--blue-500);
    color: white;
}

.day-btn:disabled {
    background: var(--gray-50);
    color: var(--gray-400);
    cursor: not-allowed;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--blue-500);
}

.checkbox-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
}

/* Recurring Checkbox */
.recurring-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.75rem;
}

.recurring-box input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--blue-500);
}

.recurring-box label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

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

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

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: var(--red-500);
    color: white;
}

.btn-danger:hover {
    background: var(--red-600);
}

.btn-danger-outline {
    background: var(--red-50);
    color: var(--red-600);
}

.btn-danger-outline:hover {
    background: #fecaca;
}

.btn-black {
    background: black;
    color: white;
}

.btn-black:hover {
    background: var(--gray-800);
}

.btn-row {
    display: flex;
    gap: 0.75rem;
}

.btn-row .btn {
    flex: 1;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    height: 1.5rem;
    width: 2.75rem;
    align-items: center;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s;
    background: var(--gray-300);
    border: none;
}

.toggle-switch.active {
    background: var(--blue-500);
}

.toggle-switch-knob {
    display: inline-block;
    height: 1rem;
    width: 1rem;
    border-radius: 9999px;
    background: white;
    transition: transform 0.2s;
    transform: translateX(0.25rem);
}

.toggle-switch.active .toggle-switch-knob {
    transform: translateX(1.5rem);
}

/* Post Item */
.post-list {
    padding-bottom: 5rem;
}

.post-item {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.post-schedule-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.post-schedule-info svg {
    width: 1rem;
    height: 1rem;
}

.badge-once {
    font-size: 0.75rem;
    background: var(--orange-100);
    color: var(--orange-600);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.post-content-wrapper {
    position: relative;
}

.post-toggle {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.post-body {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    padding-right: 4rem;
}

.post-body:hover {
    background: var(--gray-50);
}

.post-avatar {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    object-fit: cover;
}

.post-avatar-placeholder {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: var(--purple-200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-avatar-placeholder svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--purple-600);
}

.post-main {
    flex: 1;
    min-width: 0;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.post-username {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.post-date {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.post-text {
    font-size: 0.875rem;
    color: var(--gray-900);
    white-space: pre-wrap;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 1rem;
    color: var(--gray-500);
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.875rem;
}

.empty-state .hint {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.loading-box {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 2px solid transparent;
    border-bottom-color: var(--gray-900);
    border-radius: 9999px;
    margin-bottom: 1rem;
}

.loading-text {
    color: var(--gray-700);
    font-weight: 500;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 3rem 1.5rem;
    background: #F5F5F5;
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 3rem;
}

.login-header h2 {
    font-size: 1.25rem;
    color: black;
    line-height: 1.4;
}

.login-header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: black;
    line-height: 1.2;
    margin-top: 1rem;
}

.login-header p {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-top: 1rem;
}

.login-carousel {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

.login-carousel-item {
    width: 10rem;
    height: 10rem;
    opacity: 0.5;
    transition: all 0.3s;
}

.login-carousel-card {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-carousel-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-footer {
    width: 100%;
    padding: 0 1rem 2rem;
}

.login-btn {
    width: 100%;
    background: black;
    color: white;
    padding: 1rem;
    border-radius: 1rem;
    font-weight: 500;
    font-size: 1.125rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background: var(--gray-800);
}

/* Profile Page */
.profile-page {
    min-height: 100vh;
    background: white;
    padding-bottom: 5rem;
}

.profile-content {
    padding: 2rem 1rem;
}

.profile-avatar-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 6rem;
    height: 6rem;
    border-radius: 9999px;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 6rem;
    height: 6rem;
    border-radius: 9999px;
    background: var(--purple-200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-placeholder svg {
    width: 4rem;
    height: 4rem;
    color: var(--purple-600);
}

.profile-name {
    text-align: center;
    margin-bottom: 0.5rem;
}

.profile-name h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.profile-name p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.profile-followers {
    text-align: center;
    margin-bottom: 1rem;
}

.profile-followers p:first-child {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.profile-followers p:last-child {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.profile-divider {
    border-top: 1px solid var(--gray-200);
    margin: 1.5rem 0;
}

.profile-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
}

.profile-menu {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 2rem;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--gray-200);
}

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

.profile-menu-item:hover {
    background: var(--gray-50);
}

.profile-menu-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-menu-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-menu-icon.blue {
    background: var(--blue-100);
}

.profile-menu-icon.blue svg {
    color: var(--blue-600);
}

.profile-menu-icon.green {
    background: var(--green-100);
}

.profile-menu-icon.green svg {
    color: var(--green-600);
}

.profile-menu-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.profile-menu-text {
    font-weight: 500;
    color: var(--gray-900);
}

.profile-menu-arrow {
    color: var(--gray-400);
}

.profile-menu-arrow svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Insights Page */
.insights-page {
    min-height: 100vh;
    background: var(--gray-50);
    padding-bottom: 5rem;
}

.insights-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
}

.insights-header-inner {
    max-width: 672px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.insights-content {
    max-width: 672px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.insights-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-100);
    margin-bottom: 1.5rem;
}

.insights-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.insights-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.insights-total {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.insights-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.insights-chart {
    height: 300px;
}

/* Error Box */
.error-box {
    background: var(--red-50);
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.error-box-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-box svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--red-500);
}

.error-box p {
    font-size: 0.875rem;
    color: #b91c1c;
}

.error-box button {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--red-600);
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
}

.error-box button:hover {
    color: #b91c1c;
}

/* Filter Info Box */
.filter-info {
    padding: 0.75rem;
    background: var(--blue-50);
    border-radius: 0.5rem;
}

.filter-info p {
    font-size: 0.875rem;
    color: #1e40af;
}

.filter-info .hint {
    font-size: 0.75rem;
    color: #1d4ed8;
    margin-top: 0.25rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }

.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
