/* ====================================
   create-channel.css
   Form styling for the Create Channel page
   ==================================== */

/* --- Base Form Structure --- */

/* The form is wrapped in a card for visual separation and depth */
.form-card {
    /* Inherits background-color and box-shadow from the .card class in main.css */
    padding: var(--space-8); /* 2rem padding for a spacious feel */
    max-width: 600px; /* Constrain the form width for readability */
    margin-top: 20px;
}

/* --- Form Elements: Labels & Inputs --- */

label {
    display: block;
    margin-bottom: var(--space-6); /* Space between form groups */
    font-weight: 500;
    font-size: var(--text-base);
    color: var(--text-dark); /* Primary text color for labels (light mode) */
    transition: color 0.3s;
}

/* Dark Mode Label Overrides (Ensuring visibility) */
[data-theme="dark"] label {
    color: var(--color-text-primary);
}

input[type="text"],
input[type="url"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4); /* Add horizontal padding for text */
    margin-top: var(--space-2); /* Space between label text and input field */
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    font-size: var(--text-base);
    color: var(--text-dark);
    background-color: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s, color 0.3s, background-color 0.3s;
    -webkit-appearance: none; /* For select consistency */
    -moz-appearance: none;
    appearance: none;
}

/* Active/Focus State */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Textarea Specific Styling */
textarea {
    resize: vertical; /* Only allow vertical resizing */
    min-height: 100px; /* Ensure description has enough space */
}

/* Select Dropdown Arrow Customization (optional, but good for style) */
select {
    /* Add custom arrow for visual appeal */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 1.2em;
    padding-right: 30px; /* Make space for the custom arrow */
}

/* --- File and URL Input Group (Optional Avatar) --- */

/* Align the file and URL inputs better */
#channel-avatar-file,
#channel-avatar-url {
    margin-bottom: var(--space-4);
}

/* Hide the margin-bottom of the last input in the group */
label:last-of-type #channel-avatar-url {
    margin-bottom: 0;
}

/* --- Form Actions --- */

.form-actions {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-8); /* Spacing before buttons */
    justify-content: flex-end; /* Align buttons to the right */
}

.form-actions .btn {
    min-width: 120px; /* Give buttons a minimum standard width */
}

/* Responsive adjustment for small screens */
@media (max-width: 576px) {
    .form-card {
        margin: var(--space-4) auto;
        padding: var(--space-6);
        border-radius: var(--radius-md); /* Slightly smaller radius on mobile */
    }

    .form-actions {
        flex-direction: column; /* Stack buttons vertically on small screens */
        gap: var(--space-3);
    }
    
    .form-actions .btn {
        width: 100%; /* Full width for stacked buttons */
        min-width: unset;
    }

    /* Ensure the secondary (Cancel) button looks distinct when stacked */
    .form-actions .secondary-btn {
        order: 2; /* Put secondary button below primary button */
    }
    
    .form-actions .primary-btn {
        order: 1; /* Keep primary button on top */
    }
}

/* --- Status Message --- */
#create-status {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    text-align: center;
    font-weight: 500;
    color: var(--text-dark);
}

/* Dark Mode Status Message */
[data-theme="dark"] #create-status {
    color: var(--color-text-primary);
}

/* =======================================================
   DARK MODE FIX: Ensure Inputs and Textareas are Dark
   ======================================================= */

[data-theme="dark"] {
    /* Define a slightly lighter dark for input surfaces for contrast */
    --input-bg-dark: #1F2937; 
    --input-border-dark: #374151; 
}

/* Target all text inputs, textareas, and selects */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    /* 1. Set dark background color for the input field */
    background-color: var(--input-bg-dark); 
    
    /* 2. Set light text color */
    color: var(--text-light); 
    
    /* 3. Set a subtle dark border */
    border-color: var(--input-border-dark); 
}

/* Ensure placeholder text is also light and visible */
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-medium); /* Use a medium-light gray for placeholder */
    opacity: 1; /* Override any potential opacity issues */
}

/* FIX for .form-card (if it remains white) */
/* The form card should use a dark background, often the same as the page or a surface color */
[data-theme="dark"] .form-card {
    background-color: var(--bg-dark); 
    /* Adjust shadow to be less prominent in dark mode if needed */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); 
}

