/* RC GEN PRO v8.1 - COMPONENT LIBRARY
   Phase 4: Hardware & Controls (Excel Edition)
   Style: Tactical, Zero-Radius, High Contrast
*/

/* =========================================
   1. TACTICAL BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    height: 40px;
    border-radius: var(--radius); /* 0px - STRICT */
    font-family: var(--font-tech);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--duration) var(--ease);
    position: relative;
    overflow: hidden;
    user-select: none;
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

/* Primary (Action Blue) */
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-dim);
}

/* Outline (Ghost/Secondary) */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Danger (Critical Actions) */
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border-color);
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 11px; }

/* Icon Only Button */
.btn-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    border-radius: var(--radius);
}
.btn-icon:hover { 
    color: var(--text-primary); 
    background: var(--bg-hover); 
}

.full-width { width: 100%; }
.margin-bottom { margin-bottom: var(--space-md); }

/* =========================================
   2. TECHNICAL INPUTS & FORMS
   ========================================= */
.form-row { margin-bottom: 20px; }

.form-row label {
    display: block;
    font-family: var(--font-tech);
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 700;
}

.input-tech {
    width: 100%;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary); /* FIXED: Visibility Issue */
    padding: 0 12px;
    font-family: var(--font-data);
    font-size: 14px;
    border-radius: var(--radius);
    transition: border-color 0.1s;
}

.input-tech:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: inset 3px 0 0 0 var(--primary); /* Left Accent */
    background: var(--bg-surface);
}

.input-tech::placeholder { color: var(--text-tertiary); opacity: 0.5; }

/* Select Dropdown Arrow Fix */
select.input-tech {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* =========================================
   3. DATA GRID (THE EXCEL FEEL)
   ========================================= */
.tech-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-data);
    font-size: 13px;
    min-width: 800px;
    background: var(--bg-surface);
}

.tech-table th {
    background: var(--bg-hover);
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 12px;
    font-weight: 700;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    user-select: none;
}

.grid-header-sub th {
    font-size: 11px;
    padding: 4px 8px;
    background: var(--bg-body);
    top: 38px;
}
.grid-header-sub th.sub-head {
    text-align: center;
    color: var(--text-tertiary);
}

.tech-table td {
    border: 1px solid var(--border-color);
    padding: 0; /* Important for full cell input */
    height: 38px;
    position: relative;
    vertical-align: middle;
}

/* The Cell Input - EXCEL STYLE */
.cell-input {
    width: 100%;
    height: 100%;
    border: 2px solid transparent; /* Prepare for focus border */
    background: transparent;
    color: var(--text-primary); /* FIXED: Text Visibility */
    font-family: inherit;
    font-size: inherit;
    padding: 0 12px;
    outline: none;
    display: block;
    cursor: text;
}

/* Focus State: Thick Border (Like Excel) */
.cell-input:focus {
    background: var(--bg-input);
    border-color: var(--primary); /* Blue Border */
    z-index: 5; /* Bring to top */
    position: relative;
    box-shadow: 0 0 0 1px var(--primary); /* Double thickness */
}

/* Hover Effect for row/cell guidance */
.cell-input:hover {
    background: rgba(0,0,0,0.02);
}

/* =========================================
   4. SMART VALIDATION VISUALS
   ========================================= */
/* Fail (< 33%) */
.cell-input.fail {
    color: var(--danger);
    font-weight: 700;
    background: var(--danger-bg);
}

/* Anomaly (Attendance > Total) */
.cell-input.out-of-bound {
    color: var(--warning);
    background: var(--warning-bg);
    font-weight: 700;
}

/* =========================================
   5. STATUS & UTILS
   ========================================= */
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-blue { color: var(--primary); }
.text-muted { color: var(--text-secondary); font-size: 11px; }

.badge-pro {
    background: var(--primary-dim);
    color: var(--primary);
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid var(--primary);
}

/* =========================================
   6. TOAST (HUD Notification)
   ========================================= */
.toast-wrapper {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 380px;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 14px 18px;
    font-family: var(--font-tech);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); /* Soft shadow */
    pointer-events: auto;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }

/* =========================================
   7. EMPTY STATE
   ========================================= */
.empty-state-box {
    display: none;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 40px;
}
.empty-content i {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}
.empty-content h3 {
    font-family: var(--font-tech);
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 20px;
}
.empty-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.tech-hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}