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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 2rem;
    transition: opacity 0.3s;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

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

.auth-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: #3498db;
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
}

.auth-links a {
    color: #3498db;
    text-decoration: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

/* Dashboard */
.dashboard {
    text-align: center;
}

.dashboard h1 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.welcome {
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.marketplaces {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.marketplace-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.marketplace-card h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.marketplace-card p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

/* Marketplace pages */
.marketplace-page {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.marketplace-page h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* API Setup */
.api-setup {
    background: #ecf0f1;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.api-setup h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.form-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-group {
    flex: 1;
    min-width: 200px;
}

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

.form-inline .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Actions */
.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Button spinner */
.btn-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
    font-size: 1.2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress bar */
.progress-container {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.progress-bar-wrapper {
    width: 100%;
    height: 24px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 12px;
    transition: width 0.5s ease-in-out;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-status {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.progress-status.success {
    color: #27ae60;
}

.progress-status.error {
    color: #e74c3c;
}

.progress-details {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.85rem;
}

.progress-detail-line {
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}

.progress-detail-line:last-child {
    border-bottom: none;
}

.detail-icon {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
}

/* Status */
.status {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    background: #ecf0f1;
    min-height: 3rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #e74c3c;
    color: white;
}

.alert-success {
    background: #27ae60;
    color: white;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #34495e;
    color: white;
    font-weight: 500;
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

/* Settings page - Stickers Gallery */
.settings-page {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.settings-page h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.section-desc {
    color: #7f8c8d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.section-desc code {
    background: #ecf0f1;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Upload area */
.upload-area {
    background: #f8f9fa;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.upload-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.upload-btn {
    cursor: pointer;
}

.file-name {
    color: #7f8c8d;
    font-size: 0.9rem;
    flex: 1;
    min-width: 150px;
}

.file-list {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.file-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-list li {
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}

.file-list li:last-child {
    border-bottom: none;
}

.upload-status {
    margin-top: 0.75rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.upload-status.success {
    background: #d4edda;
    color: #155724;
}

.upload-status.error {
    background: #f8d7da;
    color: #721c24;
}

/* Stickers gallery */
.stickers-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.sticker-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.sticker-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sticker-preview {
    width: 100%;
    aspect-ratio: 58 / 40;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.sticker-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sticker-info {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sticker-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sticker-size {
    font-size: 0.75rem;
    color: #95a5a6;
}

.sticker-delete {
    margin: 0 0.5rem 0.5rem;
    width: calc(100% - 1rem);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

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

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

.empty-gallery {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #95a5a6;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links a {
        margin: 0 0.5rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions .btn {
        width: 100%;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

/* PDF History */
.pdf-history-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.pdf-history-container h2 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.pdf-history-list {
    max-height: 300px;
    overflow-y: auto;
}

.pdf-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.pdf-history-item:hover {
    background-color: #f8f9fa;
}

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

.pdf-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pdf-date {
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
}

.pdf-count {
    font-size: 0.8rem;
    color: #95a5a6;
}

.pdf-actions {
    flex-shrink: 0;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.file-missing {
    font-size: 0.8rem;
    color: #e74c3c;
    font-style: italic;
}

.pdf-history-list .loading,
.pdf-history-list .empty-state,
.pdf-history-list .error {
    text-align: center;
    padding: 1.5rem;
    color: #95a5a6;
    font-size: 0.9rem;
}

.pdf-history-list .error {
    color: #e74c3c;
}

/* ── Admin panel styles ── */
.admin-page {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-page h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.admin-page .welcome {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #3498db;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    border-left: 4px solid #3498db;
}

.stat-card.stat-pending {
    border-left-color: #f39c12;
}

.stat-card.stat-frozen {
    border-left-color: #e74c3c;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

/* Sections */
.section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.section-warning {
    border-left: 4px solid #f39c12;
}

/* Disk grid */
.disk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.disk-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
}

.disk-name {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 0.25rem;
}

.disk-size {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.25rem;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: #cce5ff;
    color: #004085;
}

/* User status bar */
.user-status-bar {
    margin-bottom: 1.5rem;
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-card {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 6px;
}

.info-card h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row span {
    color: #7f8c8d;
}

/* Buttons small */
.btn-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
}

/* Form message */
.form-message {
    display: inline-block;
    margin-left: 1rem;
    color: #27ae60;
    font-weight: 500;
}

/* Data table enhancements for admin */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}
