/*
 * Genie Guidance - App-like Card Deck
 * Mobile-first responsive design
 */

/* Material Design Icons Import */
@import url('https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css');

:root {
    --primary: #A58FD1;
    --primary-dark: #3E2E6D;
    --primary-light: #D8CFF2;
    --secondary: #EADFD1;
    --success: #10b981;
    --danger: #ef4444;
    --background: #0D0C1D;
    --surface: #1a1833;
    --surface-light: #3E2E6D;
    --text: #D8CFF2;
    --text-muted: #A58FD1;
    --border: #3E2E6D;
    --card-shadow: 0 10px 40px rgba(13, 12, 29, 0.7);
    --transition: all 0.3s ease;
}

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

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--background);
    position: relative;
    padding-bottom: 80px;
}

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

.header__logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.header__actions {
    display: flex;
    gap: 0.75rem;
}

.header__btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.header__btn:hover {
    background: var(--surface-light);
    color: var(--text);
}

/* Navigation */
.nav {
    background: var(--surface);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav__inner {
    max-width: 480px;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.nav__item:hover,
.nav__item.active {
    color: var(--primary);
}

.nav__icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.nav__icon .mdi {
    font-size: 1.5rem;
}

/* Material Design Icons */
.mdi {
    line-height: 1;
}

.icon-sm { font-size: 1rem; }
.icon-md { font-size: 1.25rem; }
.icon-lg { font-size: 1.5rem; }
.icon-xl { font-size: 2rem; }
.icon-2xl { font-size: 2.5rem; }
.icon-3xl { font-size: 3rem; }
.icon-4xl { font-size: 4rem; }

/* Main Content */
.main {
    padding: 1.5rem;
}

/* Cards Overview */
.overview {
    text-align: center;
    padding: 2rem 0;
}

.overview__title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.overview__subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Progress Ring */
.progress-ring {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
}

.progress-ring__svg {
    transform: rotate(-90deg);
}

.progress-ring__bg {
    fill: none;
    stroke: var(--surface-light);
    stroke-width: 8;
}

.progress-ring__fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-ring__text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-ring__number {
    font-size: 3rem;
    font-weight: 700;
    display: block;
}

.progress-ring__label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

.stat__number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn--secondary {
    background: var(--surface-light);
    color: var(--text);
}

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

.btn--outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn--large {
    padding: 1.25rem 3rem;
    font-size: 1.125rem;
}

.btn--small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn--block {
    width: 100%;
}

.btn--icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Card Display */
.card-display {
    perspective: 1000px;
    margin: 2rem auto;
    max-width: 320px;
}

.card-flip {
    position: relative;
    width: 100%;
    padding-bottom: 140%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card-flip.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.card-front {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-front__pattern {
    font-size: 8rem;
    opacity: 0.3;
}

.card-back {
    background: var(--surface);
    transform: rotateY(180deg);
}

.card-back__image {
    width: 100%;
    height: 60%;
    object-fit: cover;
}

.card-back__content {
    padding: 1.5rem;
    text-align: center;
}

.card-back__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-back__description {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Card Category Colors */
.card--category-1 { --card-accent: #A58FD1; }
.card--category-2 { --card-accent: #EADFD1; }
.card--category-3 { --card-accent: #D8CFF2; }
.card--category-4 { --card-accent: #8B7BB5; }

.card-front {
    border: 3px solid var(--card-accent, var(--primary));
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.card-item {
    background: var(--surface);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow);
}

.card-item__image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.card-item__content {
    padding: 0.75rem;
}

.card-item__title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-item__date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-item__favorite {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: var(--secondary);
}

.card-item__favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.card-item__favorite-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: none;
    border-radius: 0.75rem;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.action-btn:hover {
    background: var(--surface-light);
    color: var(--primary);
}

.action-btn__icon {
    font-size: 1.5rem;
}

.action-btn__label {
    font-size: 0.75rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    font-size: 1rem;
    transition: var(--transition);
}

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

.form-input::placeholder {
    color: var(--text-muted);
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.message--success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.message--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.message--info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary-light);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 1rem;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal__content {
    background: var(--surface);
    border-radius: 1rem;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal.active .modal__content {
    transform: scale(1);
}

.modal__header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal__body {
    padding: 1.5rem;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.login-page__logo {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.login-page__title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-page__subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form {
    width: 100%;
    max-width: 320px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state__icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state__title {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* Settings */
.settings-section {
    background: var(--surface);
    border-radius: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

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

.settings-item:hover {
    background: var(--surface-light);
}

.settings-item__left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-item__icon {
    font-size: 1.25rem;
    color: var(--primary);
}

.settings-item__label {
    font-weight: 500;
}

.settings-item__value {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.settings-item__arrow {
    color: var(--text-muted);
}

.settings-item--danger .settings-item__label {
    color: var(--danger);
}

.settings-item--danger .settings-item__icon {
    color: var(--danger);
}

/* Admin Panel */
.admin {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

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

.admin-stat {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.admin-stat__number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.admin-stat__label {
    color: var(--text-muted);
}

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.admin-card {
    background: var(--surface);
    border-radius: 1rem;
    overflow: hidden;
}

.admin-card__image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: var(--surface-light);
}

.admin-card__content {
    padding: 1rem;
}

.admin-card__number {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.admin-card__title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.admin-card__actions {
    display: flex;
    gap: 0.5rem;
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.6); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideUp 0.5s ease;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-glow {
    animation: glow 2s infinite;
}

/* Card Draw Animation */
.draw-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.draw-animation__card {
    animation: cardReveal 1s ease-out forwards;
}

@keyframes cardReveal {
    0% {
        transform: scale(0.5) rotateY(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotateY(90deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotateY(180deg);
        opacity: 1;
    }
}

/* Responsive */
@media (min-width: 768px) {
    .app {
        max-width: 600px;
    }

    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats {
        gap: 4rem;
    }
}

@media (min-width: 1024px) {
    .app {
        max-width: 800px;
    }

    .nav {
        top: 0;
        bottom: auto;
        border-top: none;
        border-bottom: 1px solid var(--border);
    }

    body {
        padding-top: 0;
    }

    .app {
        padding-bottom: 2rem;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none !important; }
