/* ===============================================
   CERTMANAGE — Premium Certificate Management UI
   =============================================== */

/* === Reset & Base === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #003f66;
    --primary-dark: #002a45;
    --primary-light: #336585;
    --accent: #0891b2;
    --accent-dark: #0e7490;
    --success: #94ba33;
    --success-dark: #7da12b;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-dark: #dc2626;

    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.9);

    --text-primary: #1a1a1a;
    --text-secondary: #3d3d3d;
    --text-muted: #6b6b6b;
    --text-on-primary: #ffffff;

    --border: #b0b8c1;
    --border-light: #f1f5f9;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(0, 63, 102, 0.1);

    --transition: 0.25s cubic-bezier(.4, 0, .2, 1);
    --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

/* === HEADER === */
.app-header {
    height: 80px;
    /* Standardized height */
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    /* Hidden on desktop (>767px) */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 1001;
    margin-left: auto;
    /* Push to the right */
}

.header-inner {
    max-width: 1400px;
    /* Increased for wider screens */
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    /* Fill the 80px header */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo img {
    max-height: 60px;
    /* Adjusted for 80px header */
    width: auto;
    object-fit: contain;
}

.header-logo:hover {
    transform: translateY(-1px);
}


.paginate_button {
    font-size: 14px;
}


.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
    /* Ensure it stays right-aligned */
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.header-search input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 16px 8px 38px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font);
    width: 260px;
    transition: all var(--transition);
    outline: none;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
    width: 320px;
}

.header-nav-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition);
    align-items: center;
    gap: 7px;
}

.header-nav-link:hover {
    color: var(--primary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-user-name {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-user-name i {
    font-size: 1.1rem;
    color: var(--primary);
}

.header-logout-form {
    display: inline;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--danger);
    background: var(--bg-surface);
    color: var(--danger);
    font-family: var(--font);
    font-size: 0.825rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: #fef2f2;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
    transform: translateY(-1px);
}

/* === FLASH MESSAGES === */
.flash-message {
    max-width: 1320px;
    margin: 12px auto 0;
    padding: 12px 48px 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: slideDown 0.35s ease;
    position: relative;
}

.flash-message span {
    flex: 1;
}

.flash-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* Base Alert Styling */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid transparent;
    width: 100%;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert i {
    margin-right: 8px;
}

.flash-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: .6;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.flash-close:hover {
    opacity: 1;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === MAIN CONTENT === */
.app-main {
    flex: 1;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

/* === FOOTER === */
.app-footer {
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* =============================
   LOGIN PAGE
   ============================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand i {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    margin-bottom: 12px;
}

.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group .input-wrap {
    position: relative;
}

.form-group .input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.925rem;
    transition: all var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
}

.form-group input.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    color: #ef4444;
    font-size: 0.825rem;
    font-weight: 600;
    margin-top: 6px;
    display: block;
}

.btn-primary {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #4338ca);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* =============================
   DASHBOARD
   ============================= */
.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: rgba(99, 102, 241, .15);
    color: var(--primary-light);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, .15);
    color: var(--accent);
}

.stat-icon.green {
    background: rgba(16, 185, 129, .15);
    color: var(--success);
}

.stat-info h3 {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 4px;
}

/* Section heading with action */
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-heading h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.section-heading a {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary-light);
}

.section-heading a:hover {
    color: var(--accent);
}

.btn-view-all {
    /* Height handled by .btn class */
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff !important;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-view-all:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
    color: #ffffff !important;
}

/* =============================
   DATA TABLE (shared)
   ============================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-wrap {
    overflow-x: hidden;
    margin-bottom: 20px;
}

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

.data-table thead {
    background: rgba(99, 102, 241, .08);
}

.data-table th {
    text-align: left;
    padding: 14px 18px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.table-empty i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    color: var(--border-light);
}

/* === Action buttons inside table === */
.table-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    font-family: var(--font);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-view {
    background: rgba(6, 182, 212, .12);
    color: var(--accent);
}

.btn-view:hover {
    background: rgba(6, 182, 212, .22);
    color: var(--accent);
}

.btn-edit {
    background: rgba(99, 102, 241, .12);
    color: var(--primary-light);
}

.btn-edit:hover {
    background: rgba(99, 102, 241, .22);
    color: var(--primary-light);
}

.btn-delete {
    background: rgba(239, 68, 68, .1);
    color: var(--danger);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, .2);
    color: var(--danger);
}

.btn-download {
    background: rgba(16, 185, 129, .12);
    color: var(--success);
}

.btn-download:hover {
    background: rgba(16, 185, 129, .22);
    color: var(--success);
}

.btn-download.disabled {
    background: rgba(100, 116, 139, .1);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

/* === Specific Action Buttons === */
.btn-reset {
    background-color: #d97706 !important;
    /* Amber 600 */
    color: #ffffff !important;
    border: 1px solid #b45309 !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-reset:hover {
    background-color: #b45309 !important;
    /* Amber 700 */
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.3);
    transform: translateY(-1px);
}

.btn-cancel {
    background-color: #64748b !important;
    /* Slate 500 */
    color: #ffffff !important;
    border: 1px solid #475569 !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-cancel:hover {
    background-color: #475569 !important;
    /* Slate 600 */
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
    transform: translateY(-1px);
}

/* =============================
   TOOLBAR (above table)
   ============================= */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    height: 42px;
    /* Global standard height */
    padding: 0 20px;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-sm {
    height: 34px;
    /* Global standard small height */
    padding: 0 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all var(--transition);
}

.btn i {
    font-size: 0.95rem;
}

/* Certificate Edit Page Action Row */
.certificate-actions-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-action-main {
    flex: none;
    /* Removed min-width as per request */
}

/* Bottom Actions Fixed Width */
.form-actions-bottom {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    /* justify-content: center;*/
    /* Center-aligned as requested */
    margin-top: 30px;
}

.hide-mobile {
    display: inline;
}

.btn-add {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    /* Removed min-width */
}

.btn-add:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
    color: var(--text-on-primary);
}

.btn-export {
    background: #15803d;
    color: #ffffff;
    border: 1px solid #166534;
}

.btn-export:hover {
    background: #166534;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
    transform: translateY(-1px);
}

/* === Toolbar Right (Search) === */
.toolbar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    min-width: 300px;
}

/* === Advanced Search Toggle === */
.search-form-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.search-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.search-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-search-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-search-toggle:hover {
    background: var(--bg-body);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-search-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-input-wrap i.fa-search {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-input-wrap input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font);
    transition: all var(--transition);
    outline: none;
}

.search-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color var(--transition);
    /* Fix alignment */
    align-items: center;
    /* Fix alignment */
    justify-content: center;
    /* Fix alignment */
}

.search-clear:hover {
    color: var(--danger);
}

.btn-search {
    padding: 10px 20px;
    background: var(--bg-header);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-search:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
}

.search-results-info {
    background: rgba(99, 102, 241, .08);
    border: 1px solid rgba(99, 102, 241, .2);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results-info i {
    color: var(--primary-light);
}

/* page header (like "Certification List") */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* =============================
   PAGINATION
   ============================= */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 4px;
}

.pagination-wrap nav>div {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Override Laravel's default pagination styling */
.pagination-wrap .relative.inline-flex,
.pagination-wrap nav span,
.pagination-wrap nav a {
    display: inline-flex;
}

.pagination-wrap nav>div:first-child {
    display: none;
}

.pagination-wrap nav>div:last-child>span {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-wrap nav>div:last-child>span>a,
.pagination-wrap nav>div:last-child>span>span {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-family: var(--font);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.pagination-wrap nav>div:last-child>span>a:hover {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
}

.pagination-wrap nav>div:last-child>span>span>span {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
}

/* active page */
.pagination-wrap nav>div:last-child>span>span:not(:first-child):not(:last-child) span {
    background: var(--primary);
    color: var(--text-on-primary);
    border: 1px solid var(--primary);
}

/* disabled prev/next */
.pagination-wrap nav>div:last-child>span>span:first-child span,
.pagination-wrap nav>div:last-child>span>span:last-child span {
    color: var(--text-muted);
    border-color: var(--border);
    cursor: not-allowed;
    opacity: .5;
}

/* =============================
   CERTIFICATE FORM
   ============================= */
.form-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}

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

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-column: 1 / -1;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: -24px -24px 24px -24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: #e9ecef;
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.section-title i {
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
}

/* Specific colors for section icons */
.form-section:nth-of-type(1) .section-title i {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
}

.form-section:nth-of-type(2) .section-title i {
    color: var(--accent);
    background: rgba(8, 145, 178, 0.08);
}

.form-section.full-width:nth-of-type(3) .section-title i {
    color: var(--success);
    background: rgba(16, 185, 129, 0.08);
}

.form-section.full-width:nth-of-type(4) .section-title i {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.08);
}

.form-row {
    margin-bottom: 18px;
}

/* Form Row Layouts */
.form-row-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-separator {
    height: 1px;
    background: var(--border-light);
    margin: 25px 0;
    width: 100%;
}

.form-row-3col>.form-row {
    margin-bottom: 0;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.required {
    color: var(--danger);
    margin-left: 2px;
}

.form-row input,
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
}

.form-row textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row input[type="file"] {
    padding: 8px;
}

/* Signature Preview */
.signature-preview-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 10px;
}

.signature-preview-card {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 12px;
    position: relative;
    min-width: 200px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.signature-preview-card img {
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
}

.signature-remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all var(--transition);
    z-index: 10;
}

.signature-remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1) rotate(90deg);
}

/* === Signature Upload UI === */
.signature-upload-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
}

.signature-controls {
    flex: 0 0 auto;
}

.signature-preview-wrapper {
    flex: 0 0 auto;
}

.signature-preview-card {
    position: relative;
    width: 150px;
    height: 80px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.signature-preview-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.remove-signature-overlay {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.remove-signature-overlay:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.signature-upload-container input[type="file"] {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.btn-upload-trigger {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
}

.btn-upload-trigger:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.form-row input.is-invalid,
.form-row textarea.is-invalid,
.form-row select.is-invalid {
    border-color: var(--danger);
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    grid-column: 1 / -1;
    flex-wrap: wrap;
}

.btn-save,
.btn-reset,
.btn-cancel,
.btn-back {
    width: auto !important;
}

.btn-save {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: var(--text-on-primary);
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(16, 185, 129, .3);
    color: var(--text-on-primary);
}

.btn-reset {
    background: rgba(100, 116, 139, .15);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-reset:hover {
    background: rgba(100, 116, 139, .25);
    color: var(--text-primary);
}

.btn-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-back:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

/* =============================
   SHOW / VIEW PAGE — COMPACT
   ============================= */

/* Legacy detail-grid kept for safety */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}

.detail-row {
    margin-bottom: 16px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* === NEW COMPACT CARD === */
.compact-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.compact-section {
    padding: 16px 20px 12px;
}

.compact-section-header {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.compact-fields--single {
    grid-template-columns: 1fr;
}

.compact-field {
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.compact-field:last-child,
.compact-field--full {
    border-right: none;
}

.compact-field--full {
    grid-column: 1 / -1;
}

.cf-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 2px;
    white-space: nowrap;
}

.cf-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.compact-divider {
    height: 1px;
    background: var(--border);
    margin: 0 20px;
}

.compact-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.compact-two-col .compact-section:first-child {
    border-right: 1px solid var(--border);
}

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 992px) {

    .form-container,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .table-wrap {
        overflow-x: auto;
    }
}

@media (max-width: 767px) {
    .header-inner {
        padding: 0 16px;
        height: 100%;
        width: 100%;
    }

    .header-nav-link,
    .header-user-name {
        display: flex;
        /* Ensure visible in menu */
    }

    .btn-logout span {
        display: inline;
        /* Ensure it stays visible unless hidden by menu */
    }

    .app-main {
        padding: 20px 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Toolbar buttons stack vertically on mobile/tablet */
    .toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px;
        width: 100%;
        margin-bottom: 24px;
    }

    .toolbar-left,
    .toolbar-right {
        flex: none;
        display: flex;
        flex-direction: column !important;
        gap: 12px;
        width: 100%;
    }

    .toolbar .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    .hide-mobile {
        display: none;
    }

    .partner-logos-inner {
        flex-direction: column-reverse;
        /* Put logo on top */
        align-items: center;
        padding: 24px 20px;
        gap: 15px;
        text-align: center;
    }

    .partner-logos-inner img {
        height: 64px;
        align-self: center;
    }

    /* Hamburger Menu Styles */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        color: var(--text-primary);
        font-size: 1.25rem;
        cursor: pointer;
        z-index: 1001;
        position: relative;
        left: 120px;
    }

    .header-user {
        display: none;
        /* Collapsible on mobile */
        position: fixed;
        top: 80px;
        /* Match header height */
        left: 0;
        width: 100%;
        background: var(--bg-card);
        flex-direction: column !important;
        padding: 24px;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
        border-bottom: 2px solid var(--primary);
        gap: 8px !important;
    }

    .header-user.active {
        display: flex;
    }

    .header-nav-link,
    .header-user-name {
        width: 100%;
        padding: 14px 16px;
        border-radius: var(--radius-sm);
        background: var(--bg-surface);
        border: 1px solid var(--border-light);
        justify-content: flex-start;
        color: var(--text-primary);
    }

    .header-nav-link i,
    .header-user-name i {
        width: 20px;
        text-align: center;
    }

    .header-logout-form {
        width: 100%;
        margin-top: 10px;
    }

    .btn-logout {
        width: 100%;
        height: 48px;
        justify-content: center;
        background: #fef2f2;
        border-color: #fecaca;
    }

    .header-right {
        margin-left: auto;
    }

    /* Tables scroll horizontally on small screens */
    .table-wrap {
        overflow-x: auto;
    }

    /* Compact sections stack */
    .compact-two-col {
        grid-template-columns: 1fr;
    }

    .compact-two-col .compact-section:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .compact-fields {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Forms responsive */
    .form-row-2col,
    .form-row-3col,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .btn-action-main {
        width: 100%;
        min-width: 100%;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 24px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .certificate-actions-row {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions-bottom {
        /* flex-direction: column;
        gap: 10px;*/

    }

    .btn-bottom-fixed {
        width: 100%;
        min-width: 100%;
    }

    .compact-fields {
        grid-template-columns: 1fr;
    }

    .partner-logos-inner img {
        height: 48px;
    }
}

/* =============================
   DELETE CONFIRMATION MODAL
   ============================= */
.delete-form {
    display: inline;
}

/* === DataTables Custom Styling === */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_processing {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.dt-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.dataTables_paginate {
    padding: 15px 20px !important;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.dataTables_paginate .paginate_button {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-md) !important;
    padding: 6px 12px !important;
    font-weight: 500 !important;
    transition: all var(--transition) !important;
    min-width: 36px;
    text-align: center;
}

.dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary-light) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
}

.dataTables_paginate .paginate_button.current {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dataTables_info {
    padding: 10px 20px !important;
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
}

.dataTables_length {
    padding: 10px 20px !important;
    color: var(--text-secondary) !important;
}

.dataTables_length select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 4px 8px;
    outline: none;
}

/* === Custom Modal (Standard Confirmation Box) === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display: block"] {
    display: flex !important;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-glow);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.modal-header {
    padding: 24px;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ef4444;
}

.modal-header i {
    font-size: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    padding: 20px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.btn-danger {
    background: #ef4444 !important;
    color: white !important;
}

.btn-danger:hover {
    background: #dc2626 !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === Partner Logos Bar === */
.partner-logos-bar {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-light);
    padding: 10px 0;
    /*margin-bottom: 10px;*/
}

.partner-logos-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0px 40px;
    display: flex;
    flex-direction: row-reverse;
    /* Swap: Logo (1st child) to Right, Heading (2nd child) to Left */
    justify-content: space-between;
    align-items: center;
    text-align: left;
    gap: 15px;
}

.partner-logos-inner img {
    max-height: 86px;
    max-width: 100%;
    height: auto;
    width: auto;
    transition: none;
    flex-shrink: 1;
}

.partner-logos-inner img:hover {
    transform: none;
}

.partner-page-heading {
    flex: 1;
}

.partner-page-heading h1 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
}

.partner-page-heading p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 3px 0 0;
}

@media (max-width: 768px) {
    .form-actions-bottom {
        justify-content: center;
    }
}

@media (max-width: 767px) {
    .partner-logos-inner {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .menu-toggle {
        left: 114px;
    }

    .btn-view-all {
        width: 30%;
    }
}

@media (max-width: 400px) {
    .menu-toggle {
        left: 100px;
    }
}

@media (max-width: 370px) {
    .menu-toggle {
        left: 90px;
    }
}

@media (max-width: 350px) {
    .menu-toggle {
        left: 70px;
    }
}