/* Base Styles */
body { text-align: center; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f0f2f5; margin: 0; padding: 20px; color: #333; }
h2, h3 { text-align: center; color: #1a237e; border-bottom: 2px solid #e0e0e0; padding-bottom: 10px; }

/* Navigation Hub */
nav { background: #1a237e; padding: 15px; border-radius: 8px; margin-bottom: 25px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); text-align: center; }
nav a { color: #ffffff; text-decoration: none; margin-right: 20px; font-weight: 500; }
nav a:hover { color: #ffeb3b; }

/* Grid and Tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 30px; }
.tile { background: #ffffff; padding: 25px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-top: 6px solid #1a237e; }

/* Field & Inputs */
.field { margin-bottom: 15px; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9em; color: #555; }

input[type="text"], input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d1d1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* REAL-TIME VALIDATION STYLING */
/* Mandatory fields highlighted when empty or invalid format */
input[required]:invalid {
    border-color: #ff5252;
    background-color: #fff8f8;
}

/* Red glow when a mandatory field is focused but still empty */
input[required]:focus:invalid {
    outline: none;
    border-color: #d32f2f;
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.3);
}

/* Green feedback when a mandatory field is correctly filled */
input[required]:valid {
    border-color: #4caf50;
    background-color: #fafffa;
}

/* Buttons */
button { background: #1a237e; color: white; padding: 12px 25px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; width: 100%; transition: background 0.2s; }
button:hover { background: #283593; }

/* Table Registry */
table { text-align: center; width: 100%; border-collapse: collapse; background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
th, td { text-align: center; padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
th { text-align: center; background-color: #1a237e; color: white; text-transform: uppercase; font-size: 0.85em; letter-spacing: 1px; }
tr:hover { text-align: center; background-color: #f9f9f9; }

/* Action Links */
.btn-edit { color: #1a237e; font-weight: bold; text-decoration: none; }
.btn-del { color: #d32f2f; font-weight: bold; text-decoration: none; margin-left: 10px; }

/* Search Area */
.search-bar { background: white; padding: 20px; border-radius: 8px; margin-bottom: 25px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* Footer Styling */
footer {
    background-color: #1a237e; /* Matches your navigation theme */
    color: #ffffff;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    width: 100%;
    border-top: 4px solid #ffeb3b; /* Yellow accent line */
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content p {
    margin: 5px 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: #ffeb3b;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.85em;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Ensure footer stays at bottom of page */
body {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

main {
    flex: 1; /* This pushes the footer down */
}

/* style.css modifications */

/* Disable default browser validation bubbles so our alert handles it */
form:invalid {
    box-shadow: none;
}

/* Base style for required inputs */
input[required] {
    border: 2px solid #ccc;
}

/* ONLY show red color if the form has the 'submitted' class AND is invalid */
form.submitted input[required]:invalid {
    border-color: #ff5252;
    background-color: #fff8f8;
}

/* Optional: Show green if valid ONLY after submission */
form.submitted input[required]:valid {
    border-color: #4caf50;
    background-color: #fafffa;
}

/* Keep the rest of your existing CSS (Tiles, Table, Nav, etc.) below... */

/* --- UPDATED VALIDATION LOGIC --- */

/* 1. Default State: Mandatory fields are strictly Black */
input[required] {
    border: 2px solid #000000 !important; 
    background-color: #ffffff;
    transition: border-color 0.2s;
}

/* 2. Disable default browser pop-up bubbles */
form:invalid {
    box-shadow: none;
}

/* 3. POST-SUBMISSION: Turn Red if invalid */
form.submitted input[required]:invalid {
    border-color: #ff5252 !important; 
    background-color: #fff8f8;
}

/* 4. POST-SUBMISSION: Turn Green if satisfied */
form.submitted input[required]:valid {
    border-color: #4caf50 !important; 
    background-color: #fafffa;
}

/* 5. Focus State: Clean blue glow while typing */
input:focus {
    outline: none;
    border-color: #1a237e !important;
    box-shadow: 0 0 5px rgba(26, 35, 126, 0.2);
}

/* Base style for mandatory fields (Initial: Black) */
input[required] {
    border: 2px solid #000000 !important;
}

/* Post-Submission Logic */
form.submitted input[required]:invalid {
    border-color: #ff5252 !important; /* Red */
    background-color: #fff8f8;
}

form.submitted input[required]:valid {
    border-color: #4caf50 !important; /* Green */
    background-color: #fafffa;
}

/* Remove default blue/gray outlines to keep focus clean */
input:focus {
    outline: none;
    border-color: #1a237e !important;
}

/* Search Area - Centered and Resized */
.search-bar { 
    background: white; 
    padding: 15px 25px; 
    border-radius: 12px; 
    margin: 0 auto 30px auto; /* Centers the container itself */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    max-width: 600px; /* Limits the width of the search box */
}

.search-bar form {
    display: flex;
    justify-content: center; /* Centers items horizontally */
    align-items: center;    /* Aligns items vertically */
    gap: 15px;              /* Space between label, input, and button */
    flex-wrap: wrap;        /* Ensures it looks good on mobile */
}

.search-bar label {
    margin: 0; /* Removes default block margins */
    white-space: nowrap;
}

.search-bar input[type="text"] {
    flex: 1;                /* Allows input to grow within the max-width */
    min-width: 200px;       /* Prevents it from getting too small */
    max-width: 300px;       /* Limits the actual size of the input box */
    padding: 10px;
    border: 1px solid #d1d1d1;
}

.search-bar button {
    width: auto;            /* Prevents the button from being full-width */
    padding: 10px 20px;
    font-size: 0.9em;
}

.search-bar a {
    font-size: 0.85em;
    color: #1a237e;
    text-decoration: none;
    font-weight: 600;
}

.search-bar a:hover {
    text-decoration: underline;
}

/* Highlight the Active Tab */
nav a.active {
    background-color: #ffeb3b; /* Yellow background */
    color: #1a237e !important; /* Navy blue text */
    padding: 8px 15px;
    border-radius: 4px;
    pointer-events: none; /* Optional: disables clicking the link you're already on */
}

/* Container for the 3 Home Buttons */
.home-button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: wrap; /* Supports mobile screens */
}

/* Individual Action Button Styling */
.action-button {
    display: inline-block;
    background-color: #1a237e; /* Navy Blue */
    color: #ffffff;
    text-decoration: none;
    padding: 20px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    border-bottom: 4px solid #ffeb3b; /* Yellow accent line */
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 200px;
    text-align: center;
}

/* Hover Effect */
.action-button:hover {
    background-color: #283593;
    transform: translateY(-5px); /* Gentle lift effect */
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    color: #ffeb3b; /* Text turns yellow on hover */
}

/* Optional: Description text spacing */
.description-text {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    padding: 0 20px;
}

/* --- Home Page Button Layout --- */
.home-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin: 50px auto;
    max-width: 1000px;
    flex-wrap: wrap; /* Wraps buttons on smaller screens */
}

/* --- Individual Button Styling --- */
.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a237e; /* Navy Blue */
    color: #ffffff;
    text-decoration: none;
    padding: 25px 35px;
    font-size: 1.2em;
    font-weight: 700;
    border-radius: 12px;
    border-bottom: 5px solid #ffeb3b; /* Thick Yellow Accent */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 260px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Hover & Interaction Effects --- */
.action-button:hover {
    background: #283593; /* Slightly lighter navy */
    color: #ffeb3b;      /* Text turns yellow */
    transform: translateY(-8px); /* Lifts up */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
    border-bottom: 5px solid #ffffff; /* Accent turns white on hover */
}

.action-button:active {
    transform: translateY(-2px); /* Pushes down when clicked */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .home-button-container {
        flex-direction: column;
        gap: 15px;
    }
    .action-button {
        width: 80%; /* Takes more width on mobile */
    }
}

/* Ensure select boxes match the input styling */
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d1d1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #1a237e;
}

/* --- Individual Button Styling (Compact Version) --- */
.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a237e; /* Navy Blue */
    color: #ffffff;
    text-decoration: none;
    
    /* Reduced sizing */
    padding: 12px 25px;       /* Smaller padding */
    font-size: 0.95em;        /* Smaller font */
    min-width: 180px;         /* Reduced width */
    
    font-weight: 600;
    border-radius: 8px;       /* Slightly smaller corners */
    border-bottom: 3px solid #ffeb3b; /* Thinner yellow line */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Hover Effect (Matches smaller size) --- */
.action-button:hover {
    background: #283593;
    color: #ffeb3b;
    transform: translateY(-3px); /* Smaller lift for smaller button */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Base Styles */
body { 
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    text-align: center; 
    font-family: 'Segoe UI', Arial, sans-serif; 
    background-color: #f0f2f5; 
    margin: 0; 
    padding: 20px; 
    color: #333; 
}

h2, h3 { text-align: center; color: #1a237e; border-bottom: 2px solid #e0e0e0; padding-bottom: 10px; }

main { flex: 1; }

/* Navigation Hub */
nav { 
    background: #1a237e; 
    padding: 15px; 
    border-radius: 8px; 
    margin-bottom: 25px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
    text-align: center; 
}

nav a { 
    color: #ffffff; 
    text-decoration: none; 
    margin: 0 10px; 
    font-weight: 500; 
    padding: 8px 15px;
    transition: all 0.3s;
}

nav a:hover { color: #ffeb3b; }

nav a.active {
    background-color: #ffeb3b;
    color: #1a237e !important;
    border-radius: 4px;
    font-weight: bold;
}

/* Home Page Action Buttons (Compact Version) */
.home-button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.action-button {
    display: inline-block;
    background-color: #1a237e;
    color: #ffffff;
    text-decoration: none;
    padding: 12px 25px;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: 8px;
    border-bottom: 3px solid #ffeb3b;
    transition: all 0.3s ease;
    min-width: 180px;
    text-align: center;
    text-transform: uppercase;
}

.action-button:hover {
    background-color: #283593;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    color: #ffeb3b;
}

/* Grid and Tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 30px; }
.tile { background: #ffffff; padding: 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-top: 6px solid #1a237e; text-align: left; }

/* Field & Inputs */
.field { margin-bottom: 15px; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9em; color: #555; }

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #000000 !important; /* Initial Mandatory State */
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
}

/* Validation Styling (Triggers after clicking Save) */
form.submitted input[required]:invalid, 
form.submitted select[required]:invalid {
    border-color: #ff5252 !important;
    background-color: #fff8f8;
}

form.submitted input[required]:valid, 
form.submitted select[required]:valid {
    border-color: #4caf50 !important;
    background-color: #fafffa;
}

input:focus, select:focus {
    outline: none;
    border-color: #1a237e !important;
    box-shadow: 0 0 5px rgba(26, 35, 126, 0.2);
}

/* --- TABLE CELL DIFFERENTIATION --- */
table { 
    width: 100%; 
    border-collapse: collapse; 
    background: white; 
    border-radius: 10px; 
    overflow: hidden; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    margin-top: 20px;
}

th, td { 
    padding: 12px 15px; 
    text-align: center; 
    border: 1px solid #e0e0e0; /* This creates the visible cell differentiation */
}

th { 
    background-color: #1a237e; 
    color: white; 
    text-transform: uppercase; 
    font-size: 0.85em; 
    letter-spacing: 1px;
}

/* Zebra Striping */
tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Row Hover Highlight */
tbody tr:hover { 
    background-color: #f1f4ff; 
}

/* Action Links */
.btn-edit { color: #1a237e; font-weight: bold; text-decoration: none; }
.btn-del { color: #d32f2f; font-weight: bold; text-decoration: none; margin-left: 10px; }

/* Search Area */
.search-bar { 
    background: white; 
    padding: 15px; 
    border-radius: 8px; 
    margin: 0 auto 25px auto; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    max-width: 600px;
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

/* Footer Styling */
footer {
    background-color: #1a237e;
    color: #ffffff;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 4px solid #ffeb3b;
}

.footer-content p { margin: 5px 0; font-size: 0.9em; opacity: 0.9; }

.home-button-container {
    display: flex;            /* Enables flexbox layout */
    justify-content: center;   /* Centers buttons horizontally */
    align-items: center;       /* Centers buttons vertically if heights differ */
    gap: 20px;                /* Adds even space between buttons */
    margin: 40px 0;           /* Adds space above and below the button row */
    flex-wrap: nowrap;         /* Keeps them on the same line */
}

.action-button {
    display: inline-block;
    padding: 15px 25px;
    background-color: #1a237e; /* PCS Navy */
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background 0.3s;
    white-space: nowrap;      /* Prevents text inside buttons from breaking */
    min-width: 200px;         /* Optional: Ensures uniform button size */
    text-align: center;
}

.action-button:hover {
    background-color: #283593;
    color: #ffeb3b;           /* PCS Yellow accent on hover */
}

/* Mobile Responsiveness: Allow wrapping only on small screens */
@media (max-width: 768px) {
    .home-button-container {
        flex-wrap: wrap; 
        gap: 10px;
    }
}

.home-button-container {
    display: flex;            /* Enables Flexbox */
    justify-content: center;   /* Centers buttons horizontally */
    align-items: center;       /* Aligns them vertically in the row */
    gap: 20px;                 /* Adds space between buttons */
    margin: 30px 0;           /* Adds space above and below the button row */
    flex-wrap: nowrap;         /* Forces them to stay on one line */
}

.action-button {
    display: inline-block;     /* Ensures they sit side-by-side */
    padding: 12px 24px;
    text-decoration: none;
    /* ... keep your existing button colors and borders here ... */
}

/* Home Page Action Buttons - Centered in one line */
.home-button-container {
    display: flex;
    justify-content: center; /* Horizontally centers the buttons */
    align-items: center;     /* Vertically centers them */
    gap: 20px;               /* Space between the buttons */
    margin: 40px 0;
    width: 100%;             /* Ensure container spans full width */
}

.action-button {
    display: inline-block;
    background-color: #1a237e;
    color: #ffffff;
    text-decoration: none;
    padding: 15px 25px;      /* Increased padding for better look */
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border-bottom: 3px solid #ffeb3b;
    transition: all 0.3s ease;
    white-space: nowrap;     /* Prevents text inside buttons from wrapping */
    text-align: center;
    min-width: 200px;        /* Consistent button size */
}

.action-button:hover {
    background-color: #283593;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    color: #ffeb3b;
}