/* ===================================
   Instagram-Style Dark Theme
   =================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #000000;
    --bg-secondary: #121212;
    --bg-card: #1c1c1e;
    --bg-input: #2c2c2e;
    --text-primary: #fafafa;
    --text-secondary: #a8a8a8;
    --text-muted: #737373;
    --border: #363636;
    --border-light: #2a2a2a;

    /* Instagram gradient */
    --ig-gradient: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    --ig-gradient-vivid: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
    --ig-blue: #0095f6;
    --ig-blue-hover: #1877f2;
    --ig-green: #58c322;
    --ig-red: #ed4956;

    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 149, 246, 0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 2rem;
    min-height: 100vh;
}

/* ===== Header / Navbar ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--ig-gradient-vivid);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.header nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.header nav a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.header nav a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.header nav a[href="logout.php"] {
    color: var(--ig-red) !important;
    margin-left: 0.5rem !important;
}

.header nav a[href="logout.php"]:hover {
    background: rgba(237, 73, 86, 0.1);
}

/* ===== Container ===== */
.container {
    max-width: 600px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* ===== Card ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    animation: fadeSlideIn 0.4s ease-out;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Headings ===== */
h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2 i {
    background: var(--ig-gradient-vivid);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-input);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--ig-gradient-vivid);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.upload-area:hover {
    border-color: transparent;
}

.upload-area:hover::before {
    opacity: 0.08;
}

.upload-area i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    background: var(--ig-gradient-vivid);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    display: block;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.upload-area input[type="file"] {
    display: none;
}

/* ===== Preview ===== */
#preview-container {
    display: none;
    margin-top: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

#preview-image {
    width: 100%;
    display: block;
    max-height: 450px;
    object-fit: cover;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

textarea,
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    resize: vertical;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--ig-blue);
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
}

textarea::placeholder,
input::placeholder {
    color: var(--text-muted);
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a8a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

select:focus {
    outline: none;
    border-color: var(--ig-blue);
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--ig-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background: var(--ig-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 149, 246, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-gradient {
    background: var(--ig-gradient);
}

.btn-gradient:hover {
    box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
    background: var(--ig-gradient);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.btn-danger {
    background: var(--ig-red);
}

.btn-danger:hover {
    background: #d63844;
    box-shadow: 0 4px 15px rgba(237, 73, 86, 0.3);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    width: auto;
    border-radius: 8px;
}

/* ===== Loader / Spinner ===== */
.loader {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top: 2px solid white;
    width: 18px;
    height: 18px;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

/* ===== Prompt List ===== */
.prompt-list {
    list-style: none;
}

.prompt-item {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-input);
    transition: all 0.2s ease;
}

.prompt-item:hover {
    border-color: #555;
}

.prompt-item.active {
    border-color: var(--ig-blue);
    background: rgba(0, 149, 246, 0.08);
}

.prompt-item.active::before {
    content: '';
    display: none;
}

.prompt-actions {
    display: flex;
    gap: 0.4rem;
}

/* ===== Hidden Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    font-weight: 500;
    font-size: 0.9rem;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--ig-red);
    background: rgba(237, 73, 86, 0.12);
    color: #ff6b78;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: var(--bg-primary);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem 2rem;
    text-align: center;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--ig-gradient-vivid);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-error {
    color: var(--ig-red);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem;
    background: rgba(237, 73, 86, 0.1);
    border-radius: 8px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== Settings Page Specifics ===== */
.settings-section-divider {
    margin: 1.75rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* ===== Prompt Modal ===== */
.modal-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 90%;
    max-width: 550px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
}

/* ===== Post Success Overlay ===== */
.success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.success-overlay i {
    font-size: 4rem;
    background: var(--ig-gradient-vivid);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.success-overlay p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Scrollbar (webkit) ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .header {
        padding: 0 1rem;
    }
    .header h1 {
        font-size: 1.05rem;
    }
    .header nav a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    .header nav a span.nav-label {
        display: none;
    }
    .container {
        padding: 0 0.75rem;
        margin-top: 1rem;
    }
    .card {
        padding: 1.25rem;
    }
    .upload-area {
        padding: 2rem 1rem;
    }
}
