/* --- Global & Base Styles (Luxury Dark Theme) --- */

:root {
    --color-primary-bg: #0d1117; /* Dark charcoal */
    --color-secondary-bg: rgba(255, 255, 255, 0.1); /* Light used for glass card blur */
    --color-accent: #8be9fd; /* Neon blue/cyan for a tech-lux feel */
    --color-gold: #ffc040; /* Soft gold for high-value accents */
    --text-primary: #e6e6e6; /* Off-white for main text */
    --text-secondary: #aaaaaa; /* Gray for subtext */
    --font-stack: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--color-primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* --- Dynamic Background Gradient (Subtle Movement) - ENHANCED FOR LUXURY --- */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 10% 20%, #1a0330 0%, #080a20 50%, #0d1117 100%);
    animation: moveGradient 45s ease infinite;
    z-index: -2;
}

@keyframes moveGradient {
    0% {
        transform: translate(-50%, -50%);
    }
    50% {
        transform: translate(0%, 0%);
    }
    100% {
        transform: translate(-50%, -50%);
    }
}

/* --- Navigation --- */
nav {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
}

.nav-container {
    width: 90%;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    text-shadow: 0 0 5px rgba(139, 233, 253, 0.5);
}

/* --- Main Content & Form Container --- */
main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

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

/* --- Glassmorphism Card Effect - ENHANCED --- */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(30px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 35px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 5px rgba(255, 255, 255, 0.05) inset;
    transition: opacity 0.5s, transform 0.3s;
}

.glass-card:hover {
    transform: translateY(-3px);
}

/* --- Header --- */
.glass-card header h1 {
    font-size: 2rem;
    color: var(--color-gold);
    margin-bottom: 0.5rem;
}

.glass-card header h2 {
    color: var(--color-accent);
}

.glass-card header p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 20px;
}

.form-group-split {
    display: flex;
    gap: 20px;
}

.form-group-split .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    font-family: var(--font-stack);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}

textarea {
    resize: vertical;
}

/* --- Date and Time Input Specific Styles --- */
input[type="date"],
input[type="time"] {
    color-scheme: dark;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* --- Button Styles --- */
.submit-button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: var(--color-gold);
    color: var(--color-primary-bg);
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.3s;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(255, 192, 64, 0.4);
}

.submit-button:hover:not(:disabled) {
    background-color: #ffd880;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 192, 64, 0.6);
}

.submit-button:disabled {
    background-color: #555;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: none;
}

/* --- ACTIVE PROCESSING SPINNER --- */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--color-primary-bg);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

/* --- Utility & Message Boxes --- */
.hidden {
    display: none !important;
}

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

.success-icon {
    font-size: 3rem;
    display: block;
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(139, 233, 253, 0.5);
    margin-bottom: 1rem;
}

.success-box h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    color: var(--color-accent);
}

/* --- UX FIX: Subtle Success Details --- */
.subtle-success-details {
    margin: 1.5rem 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 5px solid var(--color-accent);
    text-align: left;
}

.subtle-success-details p {
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.subtle-success-details strong {
    color: var(--color-gold);
}

.small-text-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 15px;
}

.error-box {
    background-color: rgba(255, 0, 0, 0.15);
    color: #ffc0c0;
    border: 1px solid rgba(255, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* --- File Selector Specific Styles --- */

.file-selector-group {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.file-list-header {
    display: grid;
    grid-template-columns: 1fr;
    font-weight: 700;
    color: var(--color-accent);
    margin-top: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.file-list-container {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 5px;
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Scrollbar styling for a luxurious touch (Webkit only) */
.file-list-container::-webkit-scrollbar {
    width: 8px;
}

.file-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.file-list-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

#file-list-status {
    padding: 15px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.file-item {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    color: #f0f0f0;
    font-size: 0.85em;
}

.file-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.file-item.selected {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-accent);
    font-weight: 500;
}

/* Targeting elements inside the selected item */
.file-item.selected .file-item-name {
    color: var(--color-accent);
}

.file-item-name {
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item input[type="radio"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.file-item-name::before {
    content: '○';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 10px;
    border: 1px solid var(--text-secondary);
    border-radius: 50%;
    text-align: center;
    line-height: 14px;
    font-size: 10px;
    color: transparent;
    transition: all 0.2s;
}

.file-item.selected .file-item-name::before {
    content: '●';
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.selector-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

.action-button {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f0f0f0;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-weight: 500;
    margin-left: 10px;
}

.action-button:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* --- Tab Navigation Styles --- */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--color-accent);
    background: rgba(139, 233, 253, 0.1);
    border-bottom-color: var(--color-accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Scheduled Posts Table Styles --- */

.scheduled-posts-container {
    margin-top: 20px;
}

#scheduled-posts-status {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-style: italic;
}

.scheduled-post-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.scheduled-post-card:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--color-accent);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.post-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-gold);
}

.post-status {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.post-status.pending {
    background: rgba(255, 192, 64, 0.2);
    color: var(--color-gold);
}

.post-status.processing {
    background: rgba(139, 233, 253, 0.2);
    color: var(--color-accent);
}

.post-status.completed {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
}

.post-status.failed {
    background: rgba(255, 0, 0, 0.2);
    color: #ff6b6b;
}

.post-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.post-info-item {
    color: var(--text-secondary);
}

.post-info-item strong {
    color: var(--text-primary);
}

.post-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.post-action-button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.post-action-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.post-action-button.delete:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* --- Credentials Box Styles --- */

.credentials-box-card {
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--color-accent);
    box-shadow: 0 0 15px rgba(139, 233, 253, 0.3);
}

.credentials-box-card header h2 {
    font-size: 1.2rem;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.warning-text {
    font-size: 0.8rem;
    color: #ff8c8c;
    margin-top: 10px;
}

.credentials-box-card .form-group-split {
    gap: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Navigation */
    .nav-container {
        width: 95%;
        padding: 0 10px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .action-button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    /* Main content */
    main {
        padding: 20px 10px;
    }

    .form-container {
        max-width: 100%;
        padding: 0 10px;
    }

    .glass-card {
        padding: 20px 15px;
        border-radius: 15px;
    }

    .glass-card header h1 {
        font-size: 1.5rem;
    }

    .glass-card header h2 {
        font-size: 1.2rem;
    }

    /* Form elements */
    .form-group-split {
        flex-direction: column;
        gap: 15px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .submit-button {
        font-size: 1rem;
        padding: 12px;
    }

    /* File selector */
    .file-list-header,
    .file-item {
        font-size: 0.8em;
    }

    .file-list-container {
        max-height: 150px;
    }

    /* Tabs */
    .tabs {
        gap: 5px;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .tab-button {
        padding: 10px 15px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Scheduled Posts */
    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .post-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .post-actions {
        flex-direction: column;
        width: 100%;
    }

    .post-action-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1rem;
    }

    #logout-button {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .glass-card {
        padding: 15px 10px;
    }

    .glass-card header h1 {
        font-size: 1.3rem;
    }
}
