/* 
   Office Mail Management System - Premium Design
   Palette: Indigo HSL
*/

:root {
    --primary-hue: 220;
    /* Indigo/Blue */
    --primary-sat: 90%;
    --primary-light: 50%;

    --color-primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light));
    --color-primary-dark: hsl(var(--primary-hue), var(--primary-sat), 35%);
    --color-primary-light: hsl(var(--primary-hue), var(--primary-sat), 94%);

    --color-text-main: hsl(220, 10%, 15%);
    --color-text-muted: hsl(220, 10%, 45%);
    --color-bg-base: hsl(220, 20%, 97%);
    --color-white: #ffffff;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--color-bg-base);
    color: var(--color-text-main);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout Utilities */
.layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header --- */
.site-header {
    background-color: var(--color-primary-dark);
    border-bottom: 1px solidhsl(220, 15%, 20%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-white);
    text-decoration: none;
    letter-spacing: -0.025em;
}

/* --- Login Page --- */
.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    overflow: hidden;
    max-width: 900px;
    width: 100%;
    min-height: 500px;
}

.login-visual {
    flex: 1;
    background: linear-gradient(-45deg, var(--color-primary), var(--color-primary-dark), #23d5ab, #23a6d5);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-visual img {
    max-width: 80%;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

.login-form-section {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-welcome h2 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
}

.login-welcome p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.2s;
    box-sizing: border-box;
    /* Fix for width issues */
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    color: var(--color-text-main);
    border: 1px solid #e2e8f0;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.alert-message {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background-color: #fee2e2;
    color: #991b1b;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
    border: 1px solid #fecaca;
}

/* --- Footer --- */
.site-footer {
    background-color: white;
    padding: 1rem 2rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 768px) {
    .login-card {
        flex-direction: column;
        max-width: 400px;
    }

    .login-visual {
        display: none;
    }

    .login-form-section {
        padding: 2rem;
    }
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--color-text-main);
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
}

.close-modal:hover {
    color: var(--color-text-main);
}

.modal-body {
    padding: 1.5rem;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Dashboard Layout (20% Sidebar / 80% Content) --- */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.app-sidebar {
    width: 20%;
    background-color: var(--color-primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-brand {
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #38bdf8;
}

/* Main Area */
.app-main {
    flex: 1;
    margin-left: 20%;
    display: flex;
    flex-direction: column;
    background-color: var(--color-bg-base);
}

/* Header */
.app-header {
    background-color: var(--color-primary-dark);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    height: 70px;
    box-sizing: border-box;
    color: white;
}

.page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.btn-logout {
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: white;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
}

.btn-logout:hover {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Content Body */
.app-content {
    padding: 2rem;
    flex: 1;
}

/* Form Row Alternating Colors */
.form-row-alt {
    padding: 0.35rem 1rem;
    /* Very compact padding */
    border-radius: 6px;
    /* Slightly tighter radius */
    margin-bottom: 0.25rem;
    /* Minimal gap */
    border: 1px solid transparent;
    display: flex;
    /* Ensure content aligns vertically if needed */
    flex-wrap: wrap;
    /* Safety for small screens */
    align-items: center;
    /* Vertical center alignment */
}

/* Distinct, Pleasing Colors (Indigo Theme match) */
.form-row-alt:nth-child(odd) {
    background-color: #e0e7ff;
    /* Indigo-100: Distinct, pleasing soft blue/indigo */
    border-color: #c7d2fe;
    /* Indigo-200 border */
    color: #312e81;
    /* Indigo-900 text for contrast */
}

.form-row-alt:nth-child(even) {
    background-color: #ffffff;
    border-color: #f1f5f9;
}

/* Adjust Input heights within these rows to fit */
.form-row-alt .form-input {
    padding: 0.35rem 0.5rem;
    /* Smaller input padding */
    font-size: 0.9rem;
}

.form-row-alt .form-label {
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Distinct Action Buttons */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    /* Or center if preferred */
}

.form-actions .btn {
    width: 90px;
    /* Fixed Equal Width */
    padding: 0.4rem 0.2rem;
    /* Compact padding */
    font-size: 0.8rem;
    /* Smaller text */
    height: 34px;
    /* Fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-save {
    background-color: #10b981;
    /* Green */
    color: white;
}

.btn-save:hover {
    background-color: #059669;
}

.btn-edit {
    background-color: #f59e0b;
    /* Amber/Orange */
    color: white;
}

.btn-edit:hover {
    background-color: #d97706;
}

.btn-delete {
    background-color: #ef4444;
    /* Red */
    color: white;
}

.btn-delete:hover {
    background-color: #dc2626;
}

.btn-search {
    background-color: var(--color-primary);
    color: white;
}