/**
 * Apple Icons Generator - Stylesheet
 * 
 * Clean, modern, and responsive design using plain CSS.
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    padding: 20px;
    color: #1a1a1a;
    line-height: 1.6;
}

/* App Header / Main Nav */
.app-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    margin: -20px -20px 24px -20px;
}
.app-header-inner {
    max-width: min(1400px, 100%);
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
    min-height: 72px;
}
.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #111827;
    font-weight: 600;
    font-size: 1.1em;
    flex-shrink: 0;
}
.app-logo:hover {
    color: #111827;
    text-decoration: none;
}
.app-logo-img {
    height: 44px;
    width: auto;
    display: block;
}
.app-logo-text {
    letter-spacing: -0.02em;
}
.app-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
}
.app-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95em;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}
.app-nav-link:hover {
    color: #111827;
    background: #f3f4f6;
    text-decoration: none;
}
.app-nav-link.active {
    color: #111827;
    background: #e5e7eb;
}
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: #64748b;
    border-radius: 9px;
    margin-left: 5px;
    vertical-align: middle;
}
.nav-drawer-link .nav-badge {
    margin-left: 8px;
}
.app-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-left: auto;
}
.app-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    max-width: 260px;
}
.app-user-greeting {
    font-size: 0.9em;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}
.app-user .btn-logout,
.app-user .btn-login,
.app-user .btn-primary {
    flex-shrink: 0;
}
.nav-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #6b7280;
    text-decoration: none;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}
.nav-bell:hover,
.nav-bell.active {
    color: #111827;
    background: #f3f4f6;
    text-decoration: none;
}
.nav-bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    margin-left: 0;
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
    padding: 0 4px;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #374151;
    transition: background 0.2s;
    margin-left: auto;
}
.nav-toggle:hover {
    background: #f3f4f6;
}
.nav-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}
.nav-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.25s;
}
.nav-drawer-overlay[aria-hidden="false"] {
    display: block;
    opacity: 1;
}
.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(280px, 85vw);
    max-width: 100%;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    z-index: 1002;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-drawer.nav-drawer-open {
    transform: translateX(0);
}
.nav-drawer-inner {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 60px;
}
.nav-drawer-user {
    padding-bottom: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.95em;
    color: #374151;
}
.nav-drawer-user .tier-badge {
    margin-left: 8px;
}
.nav-drawer-link {
    display: block;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}
.nav-drawer-link:hover,
.nav-drawer-link.active {
    background: #f3f4f6;
    color: #111827;
    text-decoration: none;
}
.nav-drawer-link.active {
    background: #e5e7eb;
}
.nav-drawer-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Compact header earlier so links never wrap under the logo */
@media (max-width: 1024px) {
    .app-nav,
    .app-user {
        display: none !important;
    }
    .nav-toggle {
        display: flex;
    }
}

@media (min-width: 1025px) {
    .nav-drawer-overlay,
    .nav-drawer {
        display: none !important;
    }
}

/* Container */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

body.auth-page .app-header-inner {
    min-height: 76px;
    padding: 16px 28px;
}
body.auth-page .app-logo-img {
    height: 48px;
}

body.auth-page .container {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 20px;
}

/* Card */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 48px;
    animation: fadeIn 0.5s ease-in;
}

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

/* Logo */
.logo-container {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 8px;
}

.logo {
    height: 60px;
    width: auto;
    max-width: 100%;
    display: inline-block;
}

/* Typography */
h1 {
    font-size: 2em;
    margin-bottom: 12px;
    color: #111827;
    text-align: center;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5em;
    margin-bottom: 8px;
    color: #111827;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.description {
    text-align: center;
    color: #6b7280;
    margin-bottom: 40px;
    font-size: 1em;
    font-weight: 400;
    line-height: 1.5;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 1em;
}

/* Text Inputs */
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 0.95em;
    font-family: inherit;
    color: #111827;
    transition: all 0.2s ease;
    margin-top: 6px;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover {
    border-color: #9ca3af;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.05);
}

/* Modern File Upload Area */
.file-upload-area {
    position: relative;
    width: 100%;
}

.file-upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    top: 0;
    left: 0;
}

.file-upload-content {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
    background: #fafafa;
    transition: all 0.2s ease;
    position: relative;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.file-upload-area:hover .file-upload-content {
    border-color: #111827;
    background: #f9fafb;
}

.file-upload-area.dragover .file-upload-content {
    border-color: #111827;
    background: #f0f0f0;
    border-style: solid;
}

.upload-icon {
    color: #6b7280;
    margin-bottom: 16px;
    transition: color 0.2s ease;
}

.file-upload-area:hover .upload-icon {
    color: #111827;
}

.file-upload-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-upload-main {
    font-size: 1em;
    font-weight: 500;
    color: #111827;
    display: block;
}

.file-upload-sub {
    font-size: 0.875em;
    color: #6b7280;
    display: block;
}

.file-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-top: 16px;
    width: 100%;
    max-width: 100%;
}

.file-name {
    flex: 1;
    font-size: 0.9em;
    color: #111827;
    font-weight: 500;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-remove {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.file-remove:hover {
    background: #f3f4f6;
    color: #111827;
}

.file-upload-area.has-file .file-upload-content {
    border-color: #111827;
    background: white;
    padding: 24px;
    min-height: auto;
}

.file-upload-area.has-file .upload-icon,
.file-upload-area.has-file .file-upload-text {
    display: none;
}

.hint {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 0.875em;
    font-weight: 400;
}

/* Platform Checkboxes */
.platforms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.platform-checkbox {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.platform-checkbox:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.platform-checkbox input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #111827;
}

.platform-checkbox input[type="checkbox"]:checked + span {
    font-weight: 500;
    color: #111827;
}

.platform-checkbox:has(input:checked) {
    border-color: #111827;
    background: #f9fafb;
}

.platform-checkbox span {
    font-size: 1em;
    user-select: none;
}

.select-all-checkbox {
    background: #f9fafb;
    border-color: #d1d5db;
    font-weight: 500;
    margin-bottom: 8px;
}

.select-all-checkbox:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 0.95em;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 10px;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: #111827;
    color: white !important;
}

.btn-primary:hover:not(:disabled) {
    background: #1f2937;
    color: white !important;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:active:not(:disabled) {
    background: #111827;
    color: white !important;
    transform: none;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9ca3af;
    color: white !important;
}

.btn-primary:visited {
    color: white !important;
}

.btn-download {
    background: #111827;
    color: white !important;
    margin-top: 0;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    align-items: stretch;
}

.result-actions .btn-download,
.result-actions .btn-new {
    width: 100%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.btn-new {
    background: #fff;
    color: #111827 !important;
    border: 1px solid #d1d5db;
    font-weight: 500;
    gap: 8px;
}

.btn-new-icon {
    flex-shrink: 0;
}

.btn-new:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827 !important;
    transform: none;
}

.btn-download:hover {
    background: #1f2937;
    color: white !important;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.btn-download:active {
    background: #111827;
    color: white !important;
    transform: none;
}

.btn-download:visited {
    color: white !important;
}

.btn-download:link {
    color: white !important;
}

/* Messages */
.message {
    padding: 14px 16px;
    border-radius: 6px;
    margin: 20px 0;
    font-weight: 400;
    font-size: 0.9em;
}

.message-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #dbeafe;
}

.message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Result Section */
.result {
    margin-top: 32px;
    padding: 24px;
    background: #f9fafb;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.result-summary {
    font-size: 0.95em;
    color: #374151;
    margin-bottom: 16px;
    font-weight: 400;
}

/* Admin Table */
.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
}

@media (max-width: 640px) {
    .admin-table th,
    .admin-table td {
        white-space: nowrap;
        font-size: 0.8em;
        padding: 0.4rem 0.5rem;
    }
    .admin-form-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    body.auth-page {
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .container {
        padding: 10px;
    }
    
    body.auth-page .container {
        padding: 16px;
    }
    
    .card {
        padding: 25px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .description {
        font-size: 1em;
    }
    
    .platforms {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 1em;
    }
}

/* User Bar */
.user-bar {
    background: white;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 12px;
}

.user-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-bar > a.btn-small,
.user-bar .user-bar-actions .btn-small {
    flex-shrink: 0;
    white-space: nowrap;
    display: inline-block;
}

.btn-logout {
    background: #dc2626;
    color: white;
    border: 1px solid #dc2626;
    font-weight: 500;
}

.btn-logout:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: white;
}

.btn-logout:active {
    background: #991b1b;
    border-color: #991b1b;
}

.btn-login {
    background: #2563eb;
    color: white;
    border: 1px solid #2563eb;
    font-weight: 500;
}

.btn-login:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}

.btn-login:active {
    background: #1e40af;
    border-color: #1e40af;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.tier-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tier-badge.tier-free {
    background: #f3f4f6;
    color: #6b7280;
}

.tier-badge.tier-basic {
    background: #eff6ff;
    color: #1e40af;
}

.tier-badge.tier-pro {
    background: #f0f9ff;
    color: #0c4a6e;
}

.usage-info {
    font-size: 0.85em;
    color: #6b7280;
    font-weight: 400;
}

.usage-warning {
    font-size: 0.85em;
    color: #991b1b;
    font-weight: 500;
    padding: 4px 8px;
    background: #fef2f2;
    border-radius: 4px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875em;
    width: auto;
    margin: 0;
    font-weight: 500;
    display: inline-block;
    text-align: center;
    min-width: 80px;
}

/* Pricing Banner */
.pricing-banner {
    background: #f9fafb;
    color: #111827;
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 24px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.pricing-banner p {
    margin-bottom: 12px;
    font-weight: 500;
}

/* Ad Container */
.ad-container {
    margin: 20px 0;
    text-align: center;
    min-height: 100px;
    width: 100%;
    max-width: 100%;
    display: block;
    overflow: hidden;
    position: relative;
}

.ad-container ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    min-width: 320px !important;
    min-height: 100px !important;
}

/* Ensure ad container has width on mobile */
@media (max-width: 768px) {
    .ad-container {
        width: 100%;
        min-width: 320px;
    }
}

/* Limit Badge */
.limit-badge {
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
    margin-left: 6px;
}

/* Pricing Section */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 0;
}

.pricing-grid-three {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.2s ease;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    border-color: #111827;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.pricing-card.current-plan {
    border-color: #111827;
    background: #f9fafb;
    border-width: 2px;
}

.pricing-card.popular-plan {
    border-color: #111827;
    border-width: 2px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: white;
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pricing-card h3 {
    font-size: 1.5em;
    margin-bottom: 12px;
    color: #111827;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.pricing-card .price {
    margin: 16px 0 24px 0;
}

.price-amount {
    font-size: 2.5em;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.03em;
    display: block;
    line-height: 1;
}

.pricing-card .price .period {
    font-size: 0.5em;
    color: #6b7280;
    font-weight: 400;
    display: block;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.features-list {
    list-style: none;
    text-align: left;
    margin: 0 0 24px 0;
    padding: 0;
    flex-grow: 1;
}

.features-list li {
    padding: 10px 0;
    padding-left: 28px;
    position: relative;
    font-size: 0.95em;
    color: #374151;
    line-height: 1.5;
}

.features-list li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #059669;
    font-weight: 600;
    font-size: 1.1em;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d1fae5;
    border-radius: 50%;
    font-size: 0.85em;
}

.pricing-card .btn {
    margin-top: auto;
    width: 100%;
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    cursor: default;
}

.btn-secondary:hover {
    background: #f3f4f6;
    color: #6b7280;
    transform: none;
    box-shadow: none;
}

/* Unlimited Tier Section */
.pricing-unlimited-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.unlimited-card {
    max-width: 400px;
    margin: 0 auto;
}

/* Generation Packs Section */
.generation-packs-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.packs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.pack-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    background: white;
    transition: all 0.2s ease;
}

.pack-card:hover {
    border-color: #111827;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pack-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.pack-price {
    font-size: 1.5em;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.pack-generations {
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 12px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #111827;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    font-weight: 300;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.modal-body {
    padding: 32px;
}

.modal-body .pricing-grid {
    margin-top: 0;
}

@media (max-width: 1024px) {
    .pricing-grid-three {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.5em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-body .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    .pricing-grid-three {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
    
    .pricing-card {
        padding: 24px 20px;
    }
}

@media (max-width: 1024px) {
    .pricing-grid-three {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
}

/* Navigation Links */
.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.nav-link:hover {
    color: #111827;
    background: #f3f4f6;
    text-decoration: none;
}

.nav-link.active {
    color: #111827;
    background: #e5e7eb;
}

/* Links */
a {
    color: #111827;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

a:hover {
    color: #374151;
    text-decoration: underline;
}

/* Form Links */
.card a {
    color: #111827;
    text-decoration: underline;
    text-decoration-color: #d1d5db;
    text-underline-offset: 3px;
}

.card a:hover {
    color: #374151;
    text-decoration-color: #9ca3af;
}

/* Button links - override default link styles */
a.btn,
a.btn-primary,
a.btn-download {
    color: white !important;
    text-decoration: none !important;
}

a.btn:hover,
a.btn-primary:hover,
a.btn-download:hover {
    color: white !important;
    text-decoration: none !important;
}

a.btn:visited,
a.btn-primary:visited,
a.btn-download:visited {
    color: white !important;
}

/* Download button - override link styles */
.btn-download,
.btn-download:link,
.btn-download:visited,
.btn-download:hover,
.btn-download:active {
    color: white !important;
    text-decoration: none !important;
    font-weight: 500;
}

/* Auth Pages Specific */
.auth-links {
    text-align: center;
    margin-top: 24px;
    color: #6b7280;
    font-size: 0.9em;
}

.auth-links a {
    color: #111827;
    font-weight: 500;
}

.auth-links p {
    margin: 12px 0;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 24px;
    }
    
    h1 {
        font-size: 1.75em;
    }
    
    .user-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .user-bar .user-info {
        flex: 1;
        min-width: 0;
    }
    
    .user-bar .user-bar-actions {
        margin-left: auto;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.3em;
    }
    
    .modal-body {
        padding: 15px;
    }
}

/* History Page Styles */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state p {
    font-size: 1.1em;
    margin-bottom: 24px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.history-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.history-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.history-card-image {
    width: 100%;
    height: 120px;
    background-image: 
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 12px;
}

.history-card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    background: transparent;
}

.history-card:hover .history-card-image img {
    transform: scale(1.05);
}

.history-card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
}

.history-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-card-header h3 {
    font-size: 0.95em;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-date {
    font-size: 0.8em;
    color: #6b7280;
    font-weight: 400;
}

.history-card-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.history-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.history-info-label {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.history-info-value {
    color: #111827;
    font-weight: 500;
    text-align: right;
    flex: 1;
    margin-left: 12px;
}

.history-card-actions {
    margin-top: auto;
    padding-top: 8px;
}

.history-card-buttons {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.history-card-actions .btn {
    width: 100%;
    justify-content: center;
    font-size: 0.9em;
    padding: 10px 16px;
}

.btn-delete {
    background: #f3f4f6;
    color: #dc2626;
    border: 1px solid #e5e7eb;
}

.btn-delete:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.history-error {
    color: #dc2626;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
    padding: 8px;
    background: #fef2f2;
    border-radius: 6px;
}

/* Shared app dialogs (confirm / alert) + delete modal */
.app-dialog,
.delete-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-dialog-overlay,
.delete-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.app-dialog-content,
.delete-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 480px;
    width: 100%;
    z-index: 1;
    animation: modalFadeIn 0.2s ease;
    border: 1px solid #e5e7eb;
}

.app-dialog-content.app-dialog-danger {
    border-color: #fecaca;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.app-dialog-header,
.delete-modal-header {
    padding: 24px 24px 0;
}

.app-dialog-header h3,
.delete-modal-header h3 {
    font-size: 1.25em;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.app-dialog-danger .app-dialog-header h3,
.delete-modal.app-dialog-danger .delete-modal-header h3 {
    color: #991b1b;
}

.app-dialog-body,
.delete-modal-body {
    padding: 20px 24px;
}

.app-dialog-body p,
.delete-modal-body p {
    margin: 0 0 12px 0;
    color: #374151;
    font-size: 0.95em;
    line-height: 1.5;
}

.app-dialog-body p:last-child,
.delete-modal-body p:last-child {
    margin-bottom: 0;
}

.app-dialog-body strong,
.delete-modal-body strong {
    color: #111827;
    font-weight: 600;
}

.app-dialog-warning,
.delete-warning {
    color: #dc2626 !important;
    font-size: 0.9em !important;
    font-weight: 500 !important;
}

.app-dialog-footer,
.delete-modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.app-toast-host {
    position: fixed;
    top: 88px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 40px));
    pointer-events: none;
}

.app-toast {
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.92em;
    line-height: 1.4;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-toast-show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast-error {
    background: #991b1b;
}

.app-toast-success {
    background: #065f46;
}

.app-toast-info {
    background: #1f2937;
}

.btn-cancel {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-cancel:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #111827;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: 1px solid #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-danger:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    
    .history-card-image {
        height: 100px;
        padding: 8px;
    }
    
    .history-card-content {
        padding: 12px;
    }
    
    .history-info-row {
        font-size: 0.85em;
    }
    
    .history-card-buttons {
        flex-direction: column;
    }
    
    .app-dialog-content,
    .delete-modal-content {
        max-width: 100%;
        margin: 20px;
    }
    
    .app-dialog-footer,
    .delete-modal-footer {
        flex-direction: column-reverse;
    }
    
    .app-dialog-footer .btn,
    .delete-modal-footer .btn {
        width: 100%;
    }

    .app-toast-host {
        top: auto;
        bottom: 20px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* Site footer + legal pages */
.site-footer {
    margin: 40px -20px -20px -20px;
    padding: 28px 20px 32px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}
.site-footer-inner {
    max-width: min(1400px, 100%);
    margin: 0 auto;
    text-align: center;
}
.site-footer-brand {
    margin: 0 0 10px;
    font-size: 0.92em;
    color: #374151;
}
.site-footer-sep {
    margin: 0 6px;
    color: #d1d5db;
}
.site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    justify-content: center;
    margin-bottom: 12px;
}
.site-footer-nav a {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}
.site-footer-nav a:hover {
    color: #111827;
    text-decoration: underline;
}
.site-footer-copy {
    margin: 0;
    font-size: 0.8em;
    color: #9ca3af;
}
.container.legal-wide {
    max-width: 800px;
}
.legal-card h1 {
    margin: 0 0 8px;
    font-size: 1.75em;
    color: #111827;
}
.legal-meta {
    margin: 0 0 16px;
    font-size: 0.88em;
    color: #9ca3af;
}
.legal-body {
    margin-top: 8px;
}
.legal-body h2 {
    margin: 28px 0 10px;
    font-size: 1.1em;
    color: #111827;
}
.legal-body p,
.legal-body li {
    color: #374151;
    font-size: 0.95em;
    line-height: 1.65;
}
.legal-body ul {
    margin: 0 0 12px;
    padding-left: 1.25rem;
}
.legal-body li {
    margin-bottom: 6px;
}
.legal-footer-links {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.92em;
}
.legal-footer-links a {
    color: #2563eb;
}
