/**
 * Maritime Compliance Sync - Common Design System
 * MLC 2006 Rest Hours Management System
 * 
 * Brutalist/Retro Design Theme
 * All pages should import this file for consistent styling.
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
    /* Base Colors */
    --bg: #ffffff;
    --fg: #000000;
    --border: #000000;
    --subtle: #f4f4f4;
    --hover: #e0e0e0;
    --transition: all 0.1s ease-out;
    
    /* MLC 2006 Compliance Colors */
    --rest-color: #FFFFFF;
    --rest-border: #E0E0E0;
    --work-color: #87CEEB;
    --work-border: #4A90A4;
    --fixed-color: #FFA500;
    --fixed-border: #CC7000;
    
    /* Violation Severity Levels */
    --violation-warning: #FFE4B5;
    --violation-minor: #FFB347;
    --violation-major: #FF6B6B;
    --violation-critical: #DC143C;
    
    /* Semantic Colors */
    --success: #4CAF50;
    --error: #DC143C;
    --warning: #FF9800;
    --info: #2196F3;
}

/* ============================================
   BASE RESET & TYPOGRAPHY
   ============================================ */
* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Consolas', 'Courier New', monospace;
    background: var(--bg);
    color: var(--fg);
}

h1 { font-size: 1.2rem; margin: 0 0 5px 0; text-transform: uppercase; letter-spacing: -1px; }
h2 { font-size: 0.9rem; margin: 0 0 20px 0; font-weight: normal; opacity: 0.7; }
h3 { font-size: 0.85rem; margin: 10px 0 5px 0; }
p { font-size: 0.8rem; line-height: 1.4; margin-bottom: 10px; }

label { 
    display: block; 
    font-size: 0.75rem; 
    margin-bottom: 5px; 
    font-weight: bold; 
    text-transform: uppercase;
}

/* ============================================
   PROGRAM HEADER
   ============================================ */
.program-header {
    background: var(--fg);
    color: var(--bg);
    padding: 3px 10px;
    text-align: center;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.program-title {
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    text-transform: uppercase;
}

.program-subtitle {
    font-size: 0.7rem;
    margin: 0;
    opacity: 0.8;
    letter-spacing: 1px;
}

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar {
    border-bottom: 2px solid var(--border);
    padding: 3px 5px;
    background: var(--bg);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    min-height: 60px;
}

.toolbar-section {
    display: flex;
    padding: 0 5px;
    align-items: center;
    gap: 8px;
}

.toolbar-divider {
    width: 2px;
    height: 30px;
    background: var(--border);
    margin: 0 5px;
}

.toolbar-label {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 5px;
    white-space: nowrap;
}

/* ============================================
   BUTTONS - Brutalist Style
   ============================================ */
button {
    display: block;
    width: 100%;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 10px;
    margin-bottom: 8px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    box-shadow: 2px 2px 0px var(--fg);
}

button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--fg);
    background: var(--subtle);
}

button:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px var(--fg);
}

button.primary {
    background: var(--fg);
    color: var(--bg);
}

button.primary:hover {
    background: #333;
}

/* Semantic Button Styles */
.btn-positive {
    transition: all 0.15s ease;
}
.btn-positive:hover {
    box-shadow: 3px 3px 0px var(--success) !important;
    border-color: var(--success) !important;
}

.btn-negative {
    transition: all 0.15s ease;
}
.btn-negative:hover {
    box-shadow: 3px 3px 0px var(--error) !important;
    border-color: var(--error) !important;
    color: var(--error) !important;
}

button.primary.btn-positive:hover {
    background: var(--success);
    border-color: var(--success) !important;
}

/* Toolbar Buttons */
.toolbar button {
    display: inline-block;
    width: auto;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Mode Buttons */
.mode-button {
    display: inline-block;
    width: auto;
    background: var(--bg);
    color: var(--fg);
    border: 2px solid var(--border);
    padding: 6px 16px;
    margin-bottom: 0;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    box-shadow: 2px 2px 0px var(--fg);
    font-weight: bold;
}

.mode-button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--fg);
    background: var(--subtle);
}

.mode-button:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px var(--fg);
}

.mode-button.active {
    background: var(--fg);
    color: var(--bg);
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px var(--fg);
}

/* Button Size Variants */
.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* ============================================
   FORM INPUTS
   ============================================ */
input[type="month"],
input[type="date"],
input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px;
    font-family: inherit;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    outline: none;
    font-size: 0.85rem;
    background: var(--bg);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--fg);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--subtle);
    color: #666;
    cursor: not-allowed;
}

.toolbar input[type="month"],
.toolbar input[type="date"],
.toolbar select {
    width: auto;
    padding: 6px 10px;
    margin-bottom: 0;
    font-size: 0.8rem;
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */
.card {
    background: var(--bg);
    border: 2px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0px var(--fg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.card-header h2 {
    font-size: 1rem;
    color: var(--fg);
    margin: 0;
    font-weight: bold;
}

/* ============================================
   TABLES
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--subtle);
    font-weight: bold;
    color: var(--fg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

tr:hover {
    background: var(--subtle);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.95);
    justify-content: center;
    align-items: center;
    z-index: 100;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border: 2px solid black;
    padding: 40px;
    width: 500px;
    max-width: 90%;
    box-shadow: 10px 10px 0px rgb(196, 21, 21);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.large { 
    width: 800px; 
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.modal-header h3 {
    font-size: 1rem;
    color: var(--fg);
    margin: 0;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.modal-footer button {
    width: auto;
    display: inline-block;
}

/* Modal Close Button */
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #333;
    box-shadow: 3px 3px 0px #cc0000;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    margin: 0;
}

.modal-close-btn:hover {
    background: #cc0000;
    color: white;
    box-shadow: 3px 3px 0px #333;
    transform: none;
}

/* ============================================
   FORM GROUPS
   ============================================ */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--fg);
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

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

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    border: 1px solid var(--border);
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
    border-color: #4CAF50;
}

.badge-warning {
    background: #FFF3CD;
    color: #856404;
    border-color: #FFC107;
}

.badge-danger {
    background: #F8D7DA;
    color: #721C24;
    border-color: #DC143C;
}

.badge-info {
    background: #D1ECF1;
    color: #0C5460;
    border-color: #17A2B8;
}

.badge-archived {
    background: var(--subtle);
    color: #666;
    border-color: #999;
}

/* ============================================
   BREADCRUMB NAVIGATION
   ============================================ */
.breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.breadcrumb a {
    color: var(--bg);
    text-decoration: none;
    opacity: 0.8;
}

.breadcrumb a:hover {
    text-decoration: underline;
    opacity: 1;
}

.breadcrumb span {
    opacity: 0.6;
    margin: 0 8px;
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--subtle);
    border: 1px solid var(--border);
}

.filter-bar label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--fg);
    cursor: pointer;
    text-transform: none;
    margin-bottom: 0;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
    background: var(--subtle);
    border: 2px dashed var(--border);
}

.empty-state p {
    margin-bottom: 15px;
}

/* ============================================
   LOADING STATE
   ============================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast {
    background: #333;
    color: #fff;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 0.85rem;
    box-shadow: 4px 4px 0px var(--fg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toast-slide-in 0.3s ease;
    max-width: 400px;
    border: 2px solid var(--fg);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-warning { background: var(--warning); color: #000; }
.toast-info { background: var(--info); }

@keyframes toast-slide-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-uppercase { text-transform: uppercase; }
.font-bold { font-weight: bold; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .toolbar-divider {
        display: none;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}


