@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* Brand Colors */
    --primary-color: #8B0000;
    --primary-hover: #a61b1b;
    
    /* Backgrounds */
    --bg-color: #F8F9FC;           /* Very light cool gray */
    --card-bg: #FFFFFF;
    --input-bg: #F3F4F6;           /* Soft gray fill for inputs */
    
    /* Text */
    --text-dark: #1F2937;
    --text-light: #6B7280;
    
    /* Structure - The "Soft" Settings */
    --radius-card: 24px;           /* Big rounded corners for container */
    --radius-elem: 14px;           /* Smooth corners for inputs/buttons */
    --radius-pill: 50px;           /* Fully round for tabs */
    
    --shadow-soft: 0 20px 40px -10px rgba(0, 0, 0, 0.06); /* Diffuse, minimal shadow */
    --border-light: 1px solid rgba(0,0,0,0.03);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* --- Layout Wrapper --- */
.main-wrapper {
    width: 100%;
    max-width: 580px; /* Slightly narrower for focus */
    margin: 0 auto;
    /* Add this line for the smooth animation effect */
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper.expanded {
    max-width: 95% !important; /* This overrides the 580px when the class is present */
}

/* Ensure the card takes up the new available space */
.expanded .card {
    max-width: 100%;
    /* Optional: reduce padding slightly on wide screens to fit more data */
    padding: 30px; 
}

/* Adjust table for large screens */
.txn-table {
    min-width: 100%;
}
/* --- The Card Design --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    padding: 48px; /* Generous spacing */
    border: var(--border-light);
}

.header-inline {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the whole group */
    gap: 20px; /* Space between logo and text */
    text-align: left; /* Text itself aligns left */
    margin-bottom: 35px;
}

.logo-img {
    width: 120px; /* Smaller when side-by-side */
    height: auto;
}

.header-text h1 {
    margin: 0;
    font-size: 1.6rem;
}

.header-text p {
    margin: 4px 0 0 0;
}

/* --- Navigation Tabs (Pills) --- */
.tabs {
    display: flex;
    justify-content: center; /* Center the tabs */
    gap: 8px;
    margin-bottom: 35px;
    padding-bottom: 0; /* Removed border bottom */
}

.tablinks {
    background: transparent;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    padding: 10px 20px;
    border-radius: var(--radius-pill); /* Pill shape */
    cursor: pointer;
    transition: all 0.2s ease;
}

.tablinks:hover {
    color: var(--primary-color);
    background-color: rgba(139, 0, 0, 0.04);
}

.tablinks.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.2); /* Soft glow */
}

/* --- Form Inputs Grid --- */
.form-grid {
    display: grid;
    /* FIX: Force exactly 50% width per column, ignoring content width */
    grid-template-columns: repeat(2, minmax(0, 1fr)); 
    gap: 20px; 
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%; /* Ensure it fills the grid cell */
    min-width: 0; /* Critical for preventing overflow in flex containers */
}

/* Full width for Description and ProcID */
.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4B5563;
    margin-left: 4px;
}

input[type="text"], 
input[type="email"], 
input[type="tel"], 
input[type="number"],
input[type="password"],
select {
    width: 100%; /* This forces the input to stay inside the column */
    padding: 14px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-elem);
    font-size: 0.95rem;
    color: var(--text-dark);
    background-color: var(--input-bg);
    transition: all 0.2s ease;
    /* Ensure padding doesn't add to the width */
    box-sizing: border-box; 
}

input:focus,
select:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 0, 0, 0.05); /* Very soft focus ring */
}

/* --- Custom Dropdown Styling --- */
select {
    appearance: none;            /* Remove default browser arrow */
    -webkit-appearance: none;    /* Safari/Chrome support */
    -moz-appearance: none;       /* Firefox support */
    cursor: pointer;
    
    /* Add a custom SVG arrow that matches your text color */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 16px;
    
    /* Add extra padding on the right so text doesn't hit the arrow */
    padding-right: 45px; 
}

/* Optional: Style the dropdown options */
select option {
    color: var(--text-dark);
    background: #fff;
    padding: 10px;
}

/* --- Button --- */
.btn-submit {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius-elem);
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 10px 20px -5px rgba(139, 0, 0, 0.3); /* Colored shadow */
}

.btn-login {
    background-color: var(--text-light);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius-elem);
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 10px 20px -5px rgba(88, 78, 78, 0.3); /* Colored shadow */
}

.btn-submit:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(1px);
}

/* --- Result Section --- */
.result-box {
    margin-top: 25px;
    padding: 20px;
    background-color: #ECFDF5;
    border-radius: var(--radius-elem);
    color: #065F46;
    font-size: 0.95rem;
    text-align: center;
}

.result-box.error {
    background-color: #FEF2F2;
    color: #991B1B;
}

.result-link {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
}

/* Placeholder States */
.placeholder-content {
    text-align: center;
    padding: 50px 0;
    color: var(--text-light);
    opacity: 0.7;
}
.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

.site-footer {
    width: 100%;
    padding: 20px 0;
    text-align: center;
    background-color: var(--bg-color);
    color: #686868;               /* Dark text */
    /* font-family: sans-serif; */
    /**border-top: 1px solid #e7e7e7;**/
}

/* Responsive */
@media (max-width: 600px) {
    .card { padding: 30px; }
    .form-grid { grid-template-columns: 1fr; gap: 16px;}
    .full-width { grid-column: span 1; }
}

/* --- History Table Styling --- */
.table-container {
    width: 100%;
    overflow-x: auto; /* Allows scrolling on small screens */
    margin-top: 10px;
    border-radius: var(--radius-elem);
    border: var(--border-light);
}

.txn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: white;
}

.txn-table th, .txn-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.txn-table th {
    background-color: var(--input-bg);
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.txn-table tr:hover {
    background-color: rgba(0,0,0,0.01);
}

/* Signature Toggle */
.sig-wrapper {
    max-width: 150px;
}

.sig-content {
    display: none;
    word-break: break-all;
    font-size: 0.7rem;
    background: #f1f1f1;
    padding: 5px;
    margin-top: 5px;
    border-radius: 4px;
}

.btn-view-sig {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 0;
}

/* Expand the card width specifically for History */
.card.history-mode {
    max-width: 900px; /* Wider for tables */
    transition: max-width 0.3s ease;
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.btn-page {
    padding: 8px 16px;
    background-color: var(--input-bg);
    color: var(--text-dark);
    text-decoration: none;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    transition: 0.2s;
}

.btn-page:hover:not(.disabled) {
    background-color: var(--primary-color);
    color: white;
}

.btn-page.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-light);
}