/* Base styles */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

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

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

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

/* Navigation */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
}

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

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

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

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

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

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

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

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

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

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    display: block;
    width: 100%;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

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

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

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

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fed7aa;
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

.login-box {
    background: var(--surface);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Dashboard */
.dashboard {
    max-width: 600px;
    margin: 0 auto;
}

.dashboard h1 {
    margin-bottom: 0.5rem;
}

.dashboard .lead {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.url-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.info-box {
    background: #f1f5f9;
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.info-box h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.info-box ol {
    margin-left: 1.25rem;
}

.info-box li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

/* Preview page */
.preview-card {
    background: var(--surface);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.preview-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.preview-header h3 {
    margin-bottom: 0.25rem;
}

.url-link {
    font-size: 0.875rem;
    color: var(--primary-color);
    word-break: break-all;
}

.preview-image {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    background: #f1f5f9;
}

.preview-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.preview-card .form-group {
    padding: 1rem 1.5rem;
    margin-bottom: 0;
}

.preview-card .form-group:last-child {
    padding-bottom: 1.5rem;
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Image selector */
.image-selector {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.image-option {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 0.25rem;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.image-option:hover {
    border-color: var(--primary-color);
}

.image-option.selected {
    border-color: var(--primary-color);
}

.image-option img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

/* Publish options */
.publish-options {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.publish-options h3 {
    margin-bottom: 1rem;
}

.platform-group {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.platform-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.platform-group h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.platform-disabled {
    opacity: 0.6;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

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

/* Button group */
.button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

/* Results page */
.results-list {
    margin-bottom: 2rem;
}

.result-item {
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid;
}

.result-success {
    border-color: var(--success-color);
}

.result-error {
    border-color: var(--error-color);
}

.result-platform {
    margin-bottom: 0.25rem;
}

.result-status {
    font-weight: 500;
}

.result-success .result-status {
    color: var(--success-color);
}

.result-error .result-status {
    color: var(--error-color);
}

.result-id {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-error-msg {
    font-size: 0.875rem;
    color: var(--error-color);
}

/* Manual copy section */
.manual-copy-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

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

.copy-box {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.copy-content {
    flex: 1;
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 0.375rem;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.875rem;
}

.copy-box .form-control {
    flex: 1;
}

.image-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.image-preview {
    margin-top: 1rem;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 0.375rem;
}

/* Utility classes */
.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
    .navbar .container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }

    .copy-box {
        flex-direction: column;
    }

    .copy-box .btn {
        width: 100%;
    }
}
