:root {
    --primary: #000000;
    --secondary: #666666;
    --accent: #0066FF;
    --background: #FFFFFF;
    --surface: #F8F9FA;
    --border: #E5E7EB;
    --success: #10B981;
    --error: #EF4444;
    --hover: #F3F4F6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: var(--background);
    color: var(--primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-top: 80px;
}

/* Header Navigation */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--background);
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-logo {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.header-nav a {
    color: var(--secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}

.header-nav a:hover {
    color: var(--primary);
}

.header-nav a.active {
    color: var(--primary);
    font-weight: 600;
}

.header-username {
    font-size: 14px;
    color: var(--secondary);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-center {
    flex: 1;
    max-width: 400px;
    display: flex;
    justify-content: center;
}

.search-bar {
    width: 100%;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 8px 16px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: transparent;
    transition: all 0.2s;
    font-family: inherit;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.search-bar input::placeholder {
    color: var(--secondary);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
    pointer-events: none;
}

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

.header-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.header-btn-secondary {
    background: transparent;
    color: var(--primary);
}

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

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px;
}

/* Header Styles */
header {
    margin-bottom: 60px;
}

header h1 {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

header p {
    color: var(--secondary);
    font-size: 16px;
    font-weight: 400;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--secondary);
    text-decoration: none;
    font-size: 14px;
    margin-top: 16px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--primary);
    color: var(--background);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--secondary);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
}

.btn-primary:hover {
    background: #0052CC;
}

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

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

.btn-danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--border);
}

.btn-danger:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Actions Bar */
.actions {
    margin-bottom: 48px;
}

/* Apps Section */
.apps-section {
    margin-top: 48px;
}

.apps-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.app-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.app-card:hover {
    border-color: #D1D5DB;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.app-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.app-name {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    color: var(--primary);
    word-break: break-word;
    line-height: 1.4;
}

.app-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-public {
    background: #ECFDF5;
    color: #059669;
}

.badge-private {
    background: #FEF3C7;
    color: #D97706;
}

.app-url {
    display: block;
    padding: 0 24px 16px 24px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    transition: color 0.2s;
}

.app-url:hover {
    color: #0052CC;
}

.app-description {
    padding: 0 24px;
    font-size: 14px;
    color: var(--secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-tags {
    padding: 0 24px 16px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.app-tag {
    font-size: 11px;
    color: var(--secondary);
    background: transparent;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.app-meta {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: transparent;
    font-size: 12px;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-meta svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.app-actions {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--secondary);
    font-size: 15px;
}

/* Upload Page Styles */
.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

.upload-instructions {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.upload-instructions h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.upload-instructions ol {
    margin-left: 20px;
    color: var(--secondary);
    font-size: 14px;
}

.upload-instructions li {
    margin-bottom: 8px;
}

.example {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.example strong {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
}

.example pre {
    background: var(--primary);
    color: var(--background);
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Monaco', 'Courier New', monospace;
    overflow-x: auto;
    line-height: 1.5;
}

code {
    background: transparent;
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

/* Form Styles */
.upload-form {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: var(--primary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--background);
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    width: 100%;
    padding: 32px 16px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    background: transparent;
}

.file-input-wrapper input[type="file"]:hover {
    border-color: var(--accent);
    background: var(--background);
}

.file-name {
    display: block;
    margin-top: 12px;
    color: var(--secondary);
    font-size: 13px;
}

/* Message Styles */
.message {
    margin-top: 24px;
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.message.success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #10B981;
    display: block;
}

.message.error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #EF4444;
    display: block;
}

.btn-loader {
    display: inline-block;
}

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

.app-card {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }

    .header-container {
        height: 56px;
        gap: 16px;
        padding: 0 16px;
    }

    .header-nav {
        display: none;
    }

    .header-center {
        max-width: none;
        flex: 1;
    }

    .search-bar {
        display: none;
    }

    .header-logo {
        font-size: 14px;
    }

    .header-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .container {
        padding: 40px 20px;
    }

    header {
        margin-bottom: 40px;
    }

    header h1 {
        font-size: 28px;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .app-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #FFFFFF;
        --secondary: #9CA3AF;
        --accent: #3B82F6;
        --background: #000000;
        --surface: #111111;
        --border: #1F2937;
        --hover: #1F2937;
    }

    .site-header {
        background: var(--background);
        border-bottom-color: var(--border);
    }

    .example pre {
        background: #1F2937;
        color: #F3F4F6;
    }

    .btn-primary {
        background: var(--accent);
    }

    .btn-primary:hover {
        background: #2563EB;
    }

    .header-btn-primary {
        background: var(--background);
        color: var(--primary);
        border: 1px solid var(--border);
    }

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

/* Custom Domain Section - Modern Minimal */
.domain-section {
    margin: 16px 24px;
    padding: 16px;
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    border: 1px solid #E5E7EB;
    border-radius: 12px;
}

.domain-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.domain-header svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.domain-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.domain-value {
    font-size: 14px;
    color: var(--secondary);
    font-family: 'SF Mono', 'Monaco', monospace;
    margin-bottom: 12px;
}

.ssl-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ssl-active {
    background: #ECFDF5;
    color: #059669;
}

.ssl-inactive {
    background: #FEF3C7;
    color: #D97706;
}

.ssl-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
    margin-top: 8px;
}

.ssl-link:hover {
    color: #0052CC;
}

.ssl-link svg {
    width: 12px;
    height: 12px;
}

.domain-instructions {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.domain-instructions-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.domain-instructions ol {
    margin-left: 18px;
    font-size: 12px;
    color: var(--secondary);
    line-height: 1.8;
}

.domain-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.domain-separator {
    height: 1px;
    background: #E5E7EB;
    margin: 16px 0;
}

/* No Domain State */
.no-domain-section {
    margin: 16px 24px;
    padding: 20px;
    background: white;
    border: 2px dashed #E5E7EB;
    border-radius: 12px;
    text-align: center;
}

.no-domain-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    opacity: 0.3;
}

.no-domain-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

.no-domain-text {
    font-size: 13px;
    color: var(--secondary);
    margin-bottom: 16px;
}

/* Attach Domain Form */
.attach-form {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.attach-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    display: block;
}

.attach-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', monospace;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.attach-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.attach-form-actions {
    display: flex;
    gap: 8px;
}

/* Status Messages */
.status-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 12px;
}

.status-success {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.status-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.status-info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

.status-warning {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: #92400E;
}

.status-message-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.status-message-text {
    font-size: 12px;
    opacity: 0.9;
}

/* Modern Button Styles */
.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--primary);
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-small:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: #0052CC;
}

.btn-secondary {
    background: #6B7280;
    color: white;
}

.btn-secondary:hover {
    background: #4B5563;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-success {
    background: #10B981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* ── Site Footer ──────────────────────────────────────────── */
.site-footer {
    margin-top: 80px;
    border-top: 1px solid var(--border);
    padding: 32px 24px;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-copy {
    font-size: 0.875rem;
    color: var(--secondary);
}

.footer-version {
    padding: 3px 10px;
    background: var(--surface);
    color: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.footer-nav {
    display: flex;
    gap: 24px;
}

.footer-nav a {
    font-size: 0.875rem;
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-nav a:hover,
.footer-nav a.active {
    color: var(--primary);
}

.footer-social {
    display: flex;
    gap: 16px;
}

.footer-social a {
    display: flex;
    color: var(--secondary);
    transition: color 0.2s;
}

.footer-social a:hover {
    color: var(--primary);
}

.footer-social svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .site-footer {
        margin-top: 48px;
        padding: 24px 16px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .footer-nav {
        gap: 16px;
    }
}
