/**
 * AI Photo System - Japanese Market
 * Warm luxury style (extending ai_photo.css)
 */

/* ==========================================================================
   Color Variables (inherit from ai_photo.css)
   ========================================================================== */

:root {
    /* Warm color palette */
    --photo-primary: #E8B4B8;
    --photo-secondary: #D4A574;
    --photo-accent: #F5E6D3;
    --photo-highlight: #FFD4A3;

    /* Gradients */
    --photo-gradient: linear-gradient(135deg, #E8B4B8 0%, #D4A574 50%, #F5E6D3 100%);
    --photo-gradient-soft: linear-gradient(180deg, rgba(232,180,184,0.08) 0%, rgba(212,165,116,0.03) 100%);
    --photo-gradient-button: linear-gradient(135deg, #E8B4B8 0%, #D4A574 100%);
    --photo-gradient-gold: linear-gradient(135deg, #D4A574 0%, #F5E6D3 50%, #D4A574 100%);

    /* Background colors (dark mode) */
    --photo-bg: #1a1a1a;
    --photo-bg-card: rgba(255, 255, 255, 0.03);
    --photo-bg-hover: rgba(232, 180, 184, 0.1);
    --photo-bg-active: rgba(232, 180, 184, 0.15);

    /* Text colors */
    --photo-text: #F5E6D3;
    --photo-text-secondary: rgba(245, 230, 211, 0.7);
    --photo-text-muted: rgba(245, 230, 211, 0.5);

    /* Borders */
    --photo-border: rgba(232, 180, 184, 0.2);
    --photo-border-active: rgba(232, 180, 184, 0.5);

    /* Shadows */
    --photo-shadow: 0 4px 24px rgba(232, 180, 184, 0.15);
    --photo-shadow-lg: 0 8px 48px rgba(232, 180, 184, 0.2);
    --photo-shadow-glow: 0 0 20px rgba(232, 180, 184, 0.3);

    /* Status colors */
    --photo-success: #7CB97C;
    --photo-error: #E88B8B;
    --photo-warning: #E8C87C;
}

/* Light theme */
[data-theme="light"] {
    --photo-bg: #FFF9F5;
    --photo-bg-card: rgba(232, 180, 184, 0.08);
    --photo-bg-hover: rgba(232, 180, 184, 0.15);
    --photo-bg-active: rgba(232, 180, 184, 0.2);
    --photo-text: #3D2C29;
    --photo-text-secondary: rgba(61, 44, 41, 0.7);
    --photo-text-muted: rgba(61, 44, 41, 0.5);
    --photo-border: rgba(232, 180, 184, 0.3);
    --photo-border-active: rgba(232, 180, 184, 0.6);
}

/* ==========================================================================
   Base Reset
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: var(--photo-bg);
    background-image: var(--photo-gradient-soft);
    color: var(--photo-text);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: var(--photo-primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--photo-secondary);
}

/* ==========================================================================
   Page Layout
   ========================================================================== */

.photo-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.photo-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--photo-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.photo-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--photo-text);
}

.photo-header .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.photo-header .brand-name {
    font-size: 18px;
    font-weight: 600;
    background: var(--photo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.photo-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.photo-header .btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--photo-border);
    border-radius: 20px;
    color: var(--photo-text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.photo-header .btn-back:hover {
    background: var(--photo-bg-hover);
    border-color: var(--photo-border-active);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--photo-border);
    cursor: pointer;
}

/* Main container */
.photo-container {
    flex: 1;
    padding-top: 56px;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Auth Pages (Login/Register)
   ========================================================================== */

.photo-auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 24px;
    padding: 40px 32px;
}

.auth-card .auth-title {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .auth-title h1 {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 8px;
    background: var(--photo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card .auth-title p {
    color: var(--photo-text-secondary);
    font-size: 15px;
}

/* Form styles */
.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--photo-text-secondary);
}

.auth-form .form-control {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--photo-border);
    border-radius: 12px;
    color: var(--photo-text);
    font-size: 16px;
    transition: all 0.3s;
}

.auth-form .form-control:focus {
    outline: none;
    border-color: var(--photo-primary);
    box-shadow: 0 0 0 3px rgba(232, 180, 184, 0.1);
}

.auth-form .form-control::placeholder {
    color: var(--photo-text-muted);
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 48px;
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--photo-text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.btn-toggle-password:hover {
    color: var(--photo-text);
}

/* Form row */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--photo-text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--photo-primary);
}

.link-forgot {
    font-size: 14px;
    color: var(--photo-primary);
}

/* Submit button */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: var(--photo-gradient-button);
    border: none;
    border-radius: 28px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--photo-shadow);
}

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

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

/* Auth switch */
.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--photo-text-secondary);
}

.auth-switch a {
    color: var(--photo-primary);
    font-weight: 500;
}

/* Auth footer */
.auth-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--photo-border);
    font-size: 13px;
    color: var(--photo-text-muted);
}

.auth-footer a {
    color: var(--photo-text-muted);
}

.auth-footer .divider {
    margin: 0 12px;
}

/* Alert */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert-danger {
    background: rgba(232, 139, 139, 0.1);
    border: 1px solid rgba(232, 139, 139, 0.3);
    color: var(--photo-error);
}

.alert-success {
    background: rgba(124, 185, 124, 0.1);
    border: 1px solid rgba(124, 185, 124, 0.3);
    color: var(--photo-success);
}

/* ==========================================================================
   User Center Pages
   ========================================================================== */

.user-container {
    padding: 24px 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.page-title {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 24px;
    background: var(--photo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* User Profile Card */
.profile-card {
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid var(--photo-primary);
}

.profile-info h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 4px;
}

.profile-info p {
    font-size: 14px;
    color: var(--photo-text-secondary);
}

/* Credits display */
.credits-card {
    background: var(--photo-gradient-soft);
    border: 1px solid var(--photo-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.credits-amount {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.credits-amount .value {
    font-size: 32px;
    font-weight: 600;
    background: var(--photo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.credits-amount .unit {
    font-size: 14px;
    color: var(--photo-text-secondary);
}

.btn-recharge {
    padding: 12px 24px;
    background: var(--photo-gradient-button);
    border: none;
    border-radius: 24px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-recharge:hover {
    transform: translateY(-2px);
    box-shadow: var(--photo-shadow);
    color: #fff;
}

/* Menu List */
.menu-list {
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--photo-border);
    color: var(--photo-text);
    text-decoration: none;
    transition: all 0.3s;
}

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

.menu-item:hover {
    background: var(--photo-bg-hover);
}

.menu-item i {
    font-size: 20px;
    width: 28px;
    color: var(--photo-primary);
}

.menu-item span {
    flex: 1;
}

.menu-item .arrow {
    color: var(--photo-text-muted);
}

/* ==========================================================================
   History Lists (Credits, Usage, Recharge)
   ========================================================================== */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.history-item .item-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--photo-bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--photo-primary);
}

.history-item .item-info h4 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.history-item .item-info p {
    font-size: 13px;
    color: var(--photo-text-muted);
}

.history-item .item-right {
    text-align: right;
}

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

.history-item .item-amount.positive {
    color: var(--photo-success);
}

.history-item .item-amount.negative {
    color: var(--photo-error);
}

.history-item .item-status {
    font-size: 12px;
    color: var(--photo-text-muted);
    margin-top: 2px;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.6) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.gallery-item .overlay button {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    margin: 0 4px;
}

/* ==========================================================================
   Recharge Page
   ========================================================================== */

.recharge-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.recharge-option {
    position: relative;
    padding: 20px;
    background: var(--photo-bg-card);
    border: 2px solid var(--photo-border);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.recharge-option:hover {
    border-color: var(--photo-border-active);
    background: var(--photo-bg-hover);
}

.recharge-option.active {
    border-color: var(--photo-primary);
    background: var(--photo-bg-active);
}

.recharge-option.popular::before {
    content: "人気";
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 4px 10px;
    background: var(--photo-gradient-gold);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #3D2C29;
}

.recharge-option .amount {
    font-size: 24px;
    font-weight: 600;
    color: var(--photo-text);
    margin-bottom: 4px;
}

.recharge-option .credits {
    font-size: 14px;
    color: var(--photo-text-secondary);
}

.recharge-option .bonus {
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(124, 185, 124, 0.1);
    border-radius: 8px;
    font-size: 12px;
    color: var(--photo-success);
}

/* Payment method */
.payment-method {
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.payment-method h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--photo-primary);
    border-radius: 12px;
    background: var(--photo-bg-active);
}

.payment-option img {
    height: 24px;
}

.payment-option span {
    flex: 1;
    font-size: 15px;
}

.payment-option i {
    color: var(--photo-primary);
}

/* ==========================================================================
   Security Page
   ========================================================================== */

.security-section {
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
}

.security-section h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.security-section h3 i {
    color: var(--photo-primary);
}

.security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--photo-border);
}

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

.security-item .item-label {
    font-size: 15px;
    color: var(--photo-text-secondary);
}

.security-item .item-value {
    font-size: 15px;
}

.btn-change {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--photo-border);
    border-radius: 20px;
    color: var(--photo-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-change:hover {
    background: var(--photo-bg-hover);
    border-color: var(--photo-border-active);
}

.btn-danger {
    padding: 14px 24px;
    background: transparent;
    border: 1px solid var(--photo-error);
    border-radius: 24px;
    color: var(--photo-error);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-danger:hover {
    background: rgba(232, 139, 139, 0.1);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--photo-text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--photo-border);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--photo-text-secondary);
}

.empty-state p {
    font-size: 14px;
}

/* ==========================================================================
   Loading
   ========================================================================== */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--photo-border);
    border-top-color: var(--photo-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 10px 16px;
    background: var(--photo-bg-card);
    border: 1px solid var(--photo-border);
    border-radius: 8px;
    color: var(--photo-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: var(--photo-bg-hover);
    border-color: var(--photo-border-active);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--photo-primary);
    border-color: var(--photo-primary);
    color: #fff;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    background: var(--photo-bg);
    border: 1px solid var(--photo-border);
    border-radius: 24px;
    padding: 32px 24px;
}

.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 14px;
    color: var(--photo-text-secondary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 24px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--photo-border);
    color: var(--photo-text);
}

.btn-cancel:hover {
    background: var(--photo-bg-hover);
}

.btn-confirm {
    background: var(--photo-gradient-button);
    border: none;
    color: #fff;
}

.btn-confirm:hover {
    box-shadow: var(--photo-shadow);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .auth-card {
        padding: 32px 24px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .credits-card {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .recharge-options {
        grid-template-columns: 1fr;
    }

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