/* Utility Styles for Forms, Alerts, and UI Elements */

/* Login Page */
.login-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    gap: 0;
}

.login-intro {
    background: linear-gradient(135deg, #075b68 0%, #054449 100%);
    color: white;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-intro .brand-mark {
    width: 50px;
    height: 50px;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
}

.login-intro h1 {
    color: white;
    line-height: 1.3;
}

.login-intro .eyebrow {
    color: rgba(255, 255, 255, 0.7);
}

.login-intro .muted {
    color: rgba(255, 255, 255, 0.7);
}

.login-card {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card h2 {
    margin-top: 0;
}

.login-card label {
    margin-bottom: 18px;
}

@media (max-width: 768px) {
    .login-wrap {
        grid-template-columns: 1fr;
    }

    .login-intro {
        padding: 40px 20px;
    }

    .login-card {
        padding: 30px 20px;
    }
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 7px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left-color: #4caf50;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border-left-color: #f44336;
}

.alert-warning {
    background-color: #fff3e0;
    color: #e65100;
    border-left-color: #ff9800;
}

/* Forms */
label {
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
    color: #15232b;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8e1e3;
    border-radius: 7px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: #15232b;
    background: white;
    margin-top: 6px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #075b68;
    box-shadow: 0 0 0 3px rgba(7, 91, 104, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Form Layouts */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-grid > label {
    grid-column: span 1;
}

.form-grid > .form-footer {
    grid-column: 1 / -1;
}

.form-narrow {
    max-width: 500px;
}

.form-narrow label {
    grid-column: span 1;
}

.form-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 20px;
}

.form-footer a {
    padding: 10px 14px;
    border-radius: 7px;
    background: #f5f5f5;
    color: #15232b;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.form-footer a:hover {
    background: #e8e8e8;
}

/* Table Styles */
.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table thead {
    background: #f5f5f5;
    border-bottom: 2px solid #d8e1e3;
}

table th {
    padding: 12px;
    text-align: left;
    font-weight: 700;
    color: #15232b;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #d8e1e3;
}

table tr:hover {
    background: #f9f9f9;
}

table small {
    display: block;
    color: #65747a;
    font-size: 12px;
    margin-top: 4px;
}

table td.warning {
    color: #d97732;
    font-weight: 600;
}

table td.empty {
    text-align: center;
    color: #65747a;
    padding: 30px 12px;
}

table a {
    color: #075b68;
    text-decoration: none;
    font-weight: 600;
}

table a:hover {
    text-decoration: underline;
}

/* Search Bar */
.searchbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.searchbar input {
    flex: 1;
    max-width: 600px;
}

.searchbar button {
    white-space: nowrap;
}

/* Card */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #15232b;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #d8e1e3;
}

.section-head h2 {
    margin: 0;
}

.section-head a {
    color: #075b68;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.section-head a:hover {
    text-decoration: underline;
}

/* Two Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Field Note */
.field-note {
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 7px;
    margin-bottom: 20px;
    grid-column: 1 / -1;
}

.field-note span {
    display: block;
    font-size: 12px;
    color: #65747a;
    margin-bottom: 4px;
}

.field-note strong {
    display: block;
    font-size: 16px;
    color: #15232b;
    margin-bottom: 4px;
}

.field-note small {
    display: block;
    font-size: 11px;
    color: #65747a;
    font-weight: normal;
}

/* Master Data Grid */
.master-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .master-grid {
        grid-template-columns: 1fr;
    }
}

/* Master Data List */
.master-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 20px;
}

.master-form input {
    margin-top: 0;
    grid-column: 1 / 2;
}

.master-form button {
    align-self: flex-end;
    white-space: nowrap;
}

.master-form input[name="code"] {
    grid-column: 1 / 2;
}

.master-form input[name="name"] {
    grid-column: 1 / 2;
}

.master-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.master-list li {
    padding: 14px 12px;
    border-bottom: 1px solid #d8e1e3;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.master-list li:last-child {
    border-bottom: none;
}

.master-list li div {
    flex: 1;
}

.master-list li strong {
    display: block;
    color: #15232b;
}

.master-list li small {
    display: block;
    color: #65747a;
    font-size: 12px;
    margin-top: 4px;
}

.master-list .delete-link {
    color: #d97732;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 12px;
}

.master-list .delete-link:hover {
    text-decoration: underline;
}

/* Button Hover States */
.button:hover {
    opacity: 0.9;
    transition: opacity 0.2s;
}

.button.primary:hover {
    background: #054449;
}

.button.dark:hover {
    background: #0a1012;
}

.button.ghost:hover {
    background: #f9f9f9;
}

/* Actions Layout */
.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.actions .button {
    flex: 1;
}

.product-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    white-space: nowrap;
}

.product-actions form {
    margin: 0;
}

.delete-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: #c05621;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.delete-button:hover {
    color: #9c2c0d;
    text-decoration: underline;
}

/* User management */
.user-form {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 10px;
}

.user-form input,
.user-form select {
    margin-top: 0;
}

.inline-form,
.inline-user-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 8px 8px 0 0;
}

.inline-user-form {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) 100px auto;
    margin: 10px 0;
}

.inline-user-form input,
.inline-user-form select {
    margin-top: 0;
}

details summary {
    color: var(--green);
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 900px) {
    .user-form,
    .inline-user-form {
        grid-template-columns: 1fr;
    }
}

/* Center Text */
.center {
    text-align: center;
}

/* Full Width Button */
.full-button {
    width: 100%;
}

/* No Scrollbar */
.table-scroll::-webkit-scrollbar {
    height: 4px;
}

.table-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #d8e1e3;
    border-radius: 2px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}
