:root {
    --green-dark: #0b7a3b;
    --green-main: #10a64a;
    --green-light: #eaf7ef;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --white: #ffffff;
    --border: #dfe7e2;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f7f5;
    color: var(--text-dark);
    min-height: 100vh;
}

.main-header {
    background: linear-gradient(
        135deg,
        var(--green-dark),
        var(--green-main)
    );
    color: var(--white);
    padding: 24px 32px;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.main-header h1 {
    font-size: 2rem;
    margin-bottom: 4px;
}

.main-header p {
    opacity: 0.9;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.dashboard {
    position: relative;
    min-height: calc(100vh - 140px);
    padding: 28px;
    border-radius: 18px;
    overflow: hidden;
    background:
        linear-gradient(
            rgba(255, 255, 255, 0.70),
            rgba(255, 255, 255, 0.82)
        ),
        url("../img/Cuyma_greenfinish.png")
        center center / cover
        no-repeat;
}

.welcome-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(3px);
}

.welcome-card h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.welcome-card p {
    color: var(--text-muted);
}

.modules-grid {
    position: relative;
    z-index: 1;
}

.module-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(3px);
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.module-card h3 {
    color: var(--green-dark);
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.module-card p {
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .main-header {
        padding: 20px;
    }

    .main-content {
        padding: 20px;
    }

    .main-header h1 {
        font-size: 1.6rem;
    }
}



/* ============================================================
   LOGIN
   ============================================================ */

.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.login-card h2 {
    margin-bottom: 8px;
    color: var(--green-dark);
}

.login-subtitle {
    margin-bottom: 24px;
    color: var(--text-muted);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-group label {
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--green-main);
}

.btn-primary {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: var(--green-main);
    color: var(--white);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--green-dark);
}

.flash-message {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.flash-message.error {
    background: #fdecec;
    color: #8a1c1c;
    border: 1px solid #f2b8b8;
}



/* ============================================================
   SESION DE USUARIO
   ============================================================ */

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.user-session {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.95rem;
}

.logout-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 10px;
    padding: 9px 12px;
}

.logout-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-session {
        width: 100%;
        justify-content: space-between;
    }
}



/* ============================================================
   MODULO CLIENTES
   ============================================================ */

.page-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.page-header h2 {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.page-header p {
    color: var(--text-muted);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 700;
}

.data-table tbody tr:hover {
    background: #f8fbf9;
}

.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-badge.activo {
    background: #e7f7ec;
    color: #166534;
}

.status-badge.inactivo {
    background: #f3f4f6;
    color: #6b7280;
}

.empty-state {
    background: var(--white);
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
}


.module-link {
    color: inherit;
    text-decoration: none;
    display: block;
}


/* ============================================================
   FORMULARIOS
   ============================================================ */

.form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    resize: vertical;
    min-height: 110px;
}

.form-group textarea:focus {
    border-color: var(--green-main);
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.btn-link {
    width: auto;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.secondary-link {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 700;
}

.secondary-link:hover {
    text-decoration: underline;
}

.flash-message.success {
    background: #e7f7ec;
    color: #166534;
    border: 1px solid #b7e2c3;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-full {
        grid-column: auto;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }
}


.action-link {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 700;
}

.action-link:hover {
    text-decoration: underline;
}


.actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inline-form {
    display: inline;
}

.action-button {
    border: none;
    background: none;
    padding: 0;
    color: var(--green-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.action-button:hover {
    text-decoration: underline;
}



.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: #6b7280;
}



.btn-primary-link {
    display: inline-block;
    width: auto;
    padding: 12px 20px;
    background: var(--green-main);
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    border-radius: 12px;
    text-align: center;
}

.btn-primary-link:hover {
    text-decoration: none;
    opacity: 0.92;
}


.btn-danger-small {
    display: inline-block;
    width: auto;
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: #b42318;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-danger-small:hover {
    opacity: 0.90;
}



.action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons form {
    margin: 0;
}

.btn-success-small {
    display: inline-block;
    width: auto;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--green-main);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.btn-success-small:hover {
    text-decoration: none;
    opacity: 0.92;
}


.recipe-table {
    min-width: 850px;
}

.recipe-table th,
.recipe-table td {
    padding: 12px 14px;
}



.home-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.10);
    text-decoration: none;
}



/* ============================================================
   DETALLE ORDEN DE FABRICACIÓN
   ============================================================ */

.of-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.of-detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.of-detail-title h2 {
    margin: 0;
}

.of-priority {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    font-weight: 700;
    font-size: 0.88rem;
}

.of-detail-dates {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.of-info-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 22px;
    box-shadow: var(--shadow);
}

.of-info-card h3 {
    margin-bottom: 16px;
    font-size: 1.08rem;
}

.of-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 22px;
}

.of-info-grid-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.of-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.of-info-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.of-info-wide {
    grid-column: span 2;
}

.of-recipe-section {
    margin-top: 14px;
}

.of-recipe-section:first-of-type {
    margin-top: 0;
}

.of-recipe-section h4 {
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    color: var(--green-dark);
    font-size: 0.95rem;
}

.of-recipe-row {
    display: grid;
    grid-template-columns: 48px 1.35fr 1.6fr 1fr;
    gap: 14px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid #eef1ef;
}

.of-recipe-row:last-child {
    border-bottom: none;
}

.of-recipe-order {
    font-weight: 700;
    color: var(--text-muted);
}

.of-recipe-name,
.of-recipe-value,
.of-recipe-machine {
    min-width: 0;
    overflow-wrap: anywhere;
}

.of-recipe-machine {
    font-weight: 600;
}

@media (max-width: 900px) {

    .of-info-grid,
    .of-info-grid-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .of-detail-header {
        flex-direction: column;
    }

    .of-recipe-row {
        grid-template-columns: 40px 1fr;
    }

    .of-recipe-value,
    .of-recipe-machine {
        grid-column: 2;
    }
}



.of-link {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 800;
}

.of-link:hover {
    text-decoration: underline;
}


/* ============================================================
   DASHBOARD PRINCIPAL
   ============================================================ */

.dashboard-home {
    min-height: calc(100vh - 140px);
    padding: 32px;
    border-radius: 20px;
    background:
        linear-gradient(
            rgba(255, 255, 255, 0.18),
            rgba(255, 255, 255, 0.28)
        ),
        url("../img/Cuyma_greenfinish.png")
        center center / cover
        no-repeat;
}

.dashboard-panel {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.50);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.10);
}

.dashboard-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-module {
    min-height: 64px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    background: var(--green-main);
    color: #ffffff;

    border-radius: 14px;
    text-decoration: none;
    font-weight: 800;
    text-align: center;

    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
}

.dashboard-module:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 18px rgba(0, 0, 0, 0.16);
    text-decoration: none;
}


.dashboard-dropdown {
    position: relative;
}

.dashboard-dropdown-button {
    width: 100%;
    border: none;
    cursor: pointer;
    font: inherit;
}

.dashboard-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    z-index: 50;
}

.dashboard-dropdown-menu a {
    display: block;
    padding: 12px 14px;
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dashboard-dropdown-menu a:last-child {
    border-bottom: none;
}

.dashboard-dropdown-menu a:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dashboard-dropdown:hover .dashboard-dropdown-menu {
    display: block;
}

.dashboard-dropdown:hover .dashboard-arrow {
    transform: rotate(180deg);
}


.dashboard-icon {
    font-size: 1.1rem;
}

.dashboard-arrow {
    font-size: 0.85rem;
    margin-left: 2px;
}

.dashboard-module-pending {
    cursor: default;
}

@media (max-width: 1000px) {
    .dashboard-menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .dashboard-menu-grid {
        grid-template-columns: 1fr;
    }
}
