/* --- 1. Root & Calm Color Palette --- */
:root {
    --background: #f4f7f6;  /* Soft, light gray background */
    --card-bg: #ffffff;       /* Clean white card */
    --border: #dde1e6;        /* Light, subtle border */
    --text: #555555;          /* Readable dark gray for text */
    --heading: #111111;      /* Strong black for headings */
    --accent: #007aff;        /* Professional, calm blue */
    --accent-hover: #0056b3;   /* Darker blue for hover */

    --success-bg: #e6f7ec;
    --success-text: #228b22;
    --success-border: #b7e1cd;
    
    --error-bg: #fbebeb;
    --error-text: #c0392b;
    --error-border: #f1c0c0;
    
    --info-bg: #e5f3ff;
    --info-text: #007aff;
    --info-border: #b8d9f9;
}

/* --- 2. General Body & Typography --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    background: var(--background);
    color: var(--text);
    margin: 0;
    padding: 0;
}

h1, h2 {
    color: var(--heading);
    margin-top: 0;
    line-height: 1.3;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }

p {
    color: var(--text);
    margin-top: 0;
    margin-bottom: 1.5rem;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--accent-hover);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* --- 3. Navigation --- */
nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

nav a {
    color: var(--heading);
    font-weight: 600;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

nav ul a {
    color: var(--text);
    font-weight: 500;
    transition: color 0.2s;
}
nav ul a:hover {
    color: var(--accent);
}

/* --- 4. Main Content Wrapper (Centered Card) --- */
.content-wrapper {
    max-width: 800px; /* Made it a bit narrower for a cleaner look */
    margin: 2.5rem auto;
    padding: 3rem; /* More padding */
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

/* --- 5. Modern Forms --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--heading);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    background: #fdfdfd; 
    border-radius: 8px;
    font-size: 1rem;
    color: var(--heading); /* Dark text for typing */
    box-sizing: border-box; /* Important! */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder {
    color: #999;
    opacity: 1;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

/* --- 6. The "Smart" File Input --- */
.form-group input[type="file"] {
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input[type="file"]::file-selector-button {
    font-weight: 600;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fdfdfd;
    color: var(--accent);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    margin-right: 1rem;
}

.form-group input[type="file"]::file-selector-button:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}


/* --- 7. The Button --- */
.btn {
    display: inline-block;
    width: 100%; /* Make button full-width for a modern form look */
    box-sizing: border-box;
    padding: 0.9rem 1.8rem;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}
.btn:active {
    transform: translateY(0);
}


/* --- 8. Flash Messages --- */
.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.messages li {
    padding: 1.2rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.messages .success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.messages .error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.messages .info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* --- 9. Dashboard Table --- */
.responsive-table {
    width: 100%;
    overflow-x: auto; /* Makes table scroll on small screens */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

/* Remove side borders for a cleaner look */
th {
    border-top: 1px solid var(--border);
    background: var(--background);
    color: var(--heading);
    font-weight: 600;
}

/* Zebra striping for readability */
tbody tr:nth-child(even) {
    background: #fdfdfd;
}

/* Make table text easier to read */
td {
    font-size: 0.95rem;
    color: var(--text);
}

/* Style the download button in the table */
td .btn {
    width: auto; /* Make button in table fit its content */
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- 11. File Preview Area --- */
/* (This is the new section you were adding) */
.file-preview-area {
    margin-top: 1.5rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    background: var(--background);
    display: none; /* Hidden by default */
}

.file-preview-area h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--heading);
    font-size: 1.2rem;
}

.file-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-preview-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Style for the "remove" button */
.file-preview-item button {
    background: none;
    border: none;
    color: var(--error-text);
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.file-preview-item button:hover {
    opacity: 0.7;
}