/* Global Styles */

@font-face {
    font-family: Archivo;
    src: url(/css/fonts/archivo/Archivo-Regular.woff);
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
  
@font-face {
    font-family: Archivo;
    src: url(/css/fonts/archivo/Archivo-Italic.woff);
    font-weight: normal;
    font-style: italic;
}
  
@font-face {
    font-family: Archivo;
    src: url(/css/fonts/archivo/Archivo-Bold.woff);
    font-weight: bold;
    font-style: normal;
}
  
@font-face {
    font-family: Archivo;
    src: url(/css/fonts/archivo/Archivo-BoldItalic.woff);
    font-weight: bold;
    font-style: italic;
}
  
@font-face {
    font-family: Departure;
    src: url(/css/fonts/departure/DepartureMono-Regular.woff);
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
  
:root {
    /* Theme colours */
    --cta-yellow: #ffD100;
    --cta-blue: #29ADFF;
    --cta-green: #10D275;
    --cta-red: #FF3668;
    --cta-purple: #6160F0;
    
    /* Backgrounds and text */
    --primary-bg: #020202;
    --secondary-bg: #141414;
    --tertiary-bg: #262626;
    --primary-text: #FFFFFF;
    --secondary-text: #9E9E9E;
}

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

body {
    font-family: 'Archivo', sans-serif;
    background: var(--primary-bg);
    min-height: 100vh;
    padding: 32px;
    color: var(--primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 700px;
    width: 100%;
}

header {
    margin-bottom: 32px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

header img {
    width: 280px;
}

h1 {
    font-size: 42px;
    line-height: 1.15;
    font-weight: 700;
    color: var(--primary-text);
}

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

h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-text);
}

h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--primary-text);
}

main {
    background: var(--secondary-bg);
    padding: 32px;
    border-radius: 10px;
}

section {
    margin-bottom: 24px;
}

section:last-child {
    margin-bottom: 0;
}

.composer textarea {
    width: 100%;
    padding: 24px;
    border: 0;
    border-radius: 4px 4px 0 0;
    font-size: 24px;
    font-family: 'Archivo', sans-serif;
    resize: vertical;
    transition: border-color 0.3s;
    color: var(--primary-text);
    background: var(--tertiary-bg);
}

.composer textarea:focus {
    outline: none;
    border-color: var(--secondary-text);
}

.composer-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.platform-toggles {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.platform-toggle {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--tertiary-bg);
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
}

.platform-toggle:hover {
    border: 2px solid var(--secondary-text);
    color: var(--primary-text);
}

.platform-toggle input[type="checkbox"] {
    display: none;
}

.platform-toggle:has(input[type="checkbox"]:checked) {
    background: var(--cta-purple);
}

.platform-toggle:has(input[type="checkbox"]:checked) .platform-name {
    color: var(--primary-text);
}

.platform-name {
    display: flex;
    align-items: center;
    font-weight: 500;
    font-family: 'Departure', monospace;
    text-transform: uppercase;
    font-size: 20px;
    color: var(--secondary-text);
}

.platform-check {
    font-size: 20px;
    color: var(--primary-text);
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

.platform-toggle:has(input[type="checkbox"]:checked) .platform-check {
    display: block !important;
    visibility: visible;
    opacity: 1;
}

.platform-icon {
    font-size: 18px;
    margin: 0 8px 0 0;
}

.toggle-status {
    font-size: 13px;
    color: #999;
    padding: 4px 12px;
    background: #fff;
    border-radius: 8px;
}

.toggle-status.configured {
    color: #28a745;
    background: #d4edda;
}

/* Actions */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-btn {
    width: 100%;
    background: var(--cta-purple);
    color: var(--primary-text);
    border: none;
    padding: 16px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Departure', monospace;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.3s;
}

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

.status-message {
    position: fixed;
    top: 32px;
    right: 32px;
    max-width: 400px;
    padding: 20px 24px;
    border-radius: 4px;
    font-size: 16px;
    text-align: left;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.status-message:empty {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.status-message.success {
    background: var(--cta-green);
    color: #155724;
}

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

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

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

/* Results */
.results {
    border-top: 2px solid #e0e0e0;
    padding-top: 20px;
}

#resultsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.result-item.success {
    background: #d4edda;
}

.result-item.error {
    background: #f8d7da;
}

.result-platform {
    font-weight: 600;
    flex: 1;
}

.result-status {
    font-size: 13px;
}

.result-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

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

.result-error {
    flex: 1;
    font-size: 13px;
    color: #721c24;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 30px;
}

.platform-settings {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

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

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

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #e0e0e0;
    text-align: right;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.login-box {
    background: var(--secondary-bg);
    padding: 48px;
    border-radius: 12px;
    text-align: center;
    max-width: 450px;
    width: 100%;
}

.login-box h2 {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--primary-text);
}

.login-box p {
    font-size: 16px;
    color: var(--secondary-text);
    margin-bottom: 32px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 14px;
    text-align: left;
    border-left: 4px solid var(--cta-red);
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #24292e;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.login-btn:hover {
    background: #1b1f23;
    transform: translateY(-2px);
}

.login-btn svg {
    flex-shrink: 0;
}

/* Tags Input */

.tags-input-section {
    margin: 6px 0 10px 0;
}

.tags-input {
    width: 100%;
    padding: 24px;
    border: 0;
    border-radius: 0 0 4px 4px;
    font-size: 20px;
    font-family: 'Archivo', sans-serif;
    color: var(--primary-text);
    background: var(--tertiary-bg);
    transition: border-color 0.3s;
}

.tags-input:focus {
    outline: none;
    border-color: var(--secondary-text);
}

.composer textarea::placeholder, .tags-input::placeholder {
    color: var(--secondary-text);
    opacity: .4;
}

.tags-hint {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--secondary-text);
    font-style: italic;
}

/* Image Upload */

.image-upload-btn {
    background: var(--tertiary-bg);
    color: var(--secondary-text);
    border: 2px solid transparent;
    padding: 16px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Departure', monospace;
    text-transform: uppercase;
    cursor: pointer;
    align-items: center;
    text-align: center;
    gap: 8px;
    width: 100%;
}

.image-upload-btn:hover {
    border-color: var(--secondary-text);
    color: var(--primary-text);
}

.image-preview {
    margin-top: 10px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: var(--tertiary-bg);
}

.image-preview img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.remove-image-btn:hover {
    background: var(--cta-red);
}

/* Footer Link */
.footer-link {
    margin-top: 32px;
    text-align: center;
    display: none !important;
}

.footer-link a {
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 16px;
    font-family: 'Departure', monospace;
    text-transform: uppercase;
    transition: color 0.3s;
}

.footer-link a:hover {
    color: var(--cta-purple);
    text-decoration: underline;
}

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

    header {
        flex-direction: row;
        align-items: center;
    }

    h1 {
        font-size: 20px;
    }

    main {
        padding: 20px;
    }

    .login-box {
        padding: 32px 24px;
    }

    .modal-content {
        margin: 20px;
    }

    .result-item {
        flex-wrap: wrap;
    }

    .result-platform {
        flex: 100%;
        margin-bottom: 5px;
    }

    .platform-toggles {
        flex-wrap: wrap;
    }

    .platform-toggle {
        flex: 0 0 calc(50% - 5px);
    }

    .status-message {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}
