/* MeshPic.uk - Stylesheet */
/* Mobile-first, clean, minimal design */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #ca8a04;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --radius: 8px;
}

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

html {
    font-size: 16px;
}

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

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container.wide {
    max-width: 800px;
}

/* Header */
header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

header h1 a {
    color: var(--primary);
    text-decoration: none;
}

header nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
}

header nav a {
    color: var(--text);
    text-decoration: none;
}

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

header nav span {
    color: var(--text-light);
}

/* Main content */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Upload section */
.upload-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border);
}

.upload-section h2 {
    margin-bottom: 0.5rem;
}

.upload-section .subtitle {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dropzone-icon {
    font-size: 3rem;
    color: var(--text-light);
    line-height: 1;
}

.dropzone .or {
    color: var(--text-light);
    font-size: 0.9rem;
}

.dropzone .file-info {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

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

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

.btn-primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

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

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

/* Upload options */
.upload-options {
    text-align: left;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0;
    color: var(--text);
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

.rate-limit-info {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Success section */
.success-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border);
}

.success-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.success-message {
    font-size: 1.1rem;
    color: var(--success);
    font-weight: 500;
}

.url-display {
    display: flex;
    width: 100%;
    max-width: 400px;
    gap: 0.5rem;
}

.url-display input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: monospace;
    background: var(--bg);
}

.preview-container {
    margin: 1rem 0;
    max-width: 100%;
}

.preview-container img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Info section */
.info-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.info-section h3 {
    margin-bottom: 1rem;
}

.info-section p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.info-section ul {
    list-style: none;
    color: var(--text-light);
}

.info-section li {
    padding: 0.25rem 0;
}

.info-section li strong {
    color: var(--text);
}

.info-section a {
    color: var(--primary);
}

/* Footer */
footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Forms (for login/register) */
.form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--border);
    max-width: 400px;
    margin: 0 auto;
}

.form-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

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

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

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

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
}

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

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.image-grid {
    display: grid;
    gap: 1rem;
}

.image-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.image-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.image-card-info {
    flex: 1;
    min-width: 0;
}

.image-card-info p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0.25rem 0;
}

.image-card-info .url {
    font-family: monospace;
    color: var(--text);
    word-break: break-all;
}

.image-card-actions {
    display: flex;
    gap: 0.5rem;
}

.image-card-actions button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

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

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

.expiry-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.expiry-badge.permanent {
    background: #dbeafe;
    color: #1e40af;
}

.expiry-badge.temporary {
    background: #fef3c7;
    color: #92400e;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

/* Stats bar */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-light);
}

.stats-bar strong {
    color: var(--text);
}

/* Inline form (for delete buttons) */
.inline-form {
    display: inline;
}

/* Expired image card */
.image-card.expired {
    opacity: 0.6;
}

.image-card.expired img {
    filter: grayscale(50%);
}

.expiry-badge.expired {
    background: #fee2e2;
    color: #991b1b;
}

/* Wider container for dashboard */
.dashboard-header ~ .stats-bar,
.dashboard-header ~ .image-grid,
.dashboard-header ~ .empty-state {
    max-width: 100%;
}

/* Spinner animation */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.btn.loading {
    position: relative;
}

/* Upload progress state */
.upload-progress {
    text-align: center;
}

.upload-progress p {
    margin: 0.5rem 0;
}

/* Error state in dropzone */
.error-icon {
    color: var(--error) !important;
    font-weight: bold;
}

.error-text {
    color: var(--error);
    font-weight: 500;
}

/* Error pages */
.error-section {
    text-align: center;
    padding: 3rem 1rem;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-section h2 {
    margin-bottom: 0.5rem;
}

.error-section p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive */
@media (min-width: 640px) {
    .container {
        padding: 0 2rem;
    }

    .dropzone {
        padding: 3rem;
    }
}
