/* ============================================
   Jira Dashboard - CSS
   v1.0.0
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-light: #f5f5f7;
    --bg-card: #ffffff;
    --accent: #0052CC;
    --accent-light: #4C9AFF;
    --accent-dark: #003884;
    --text: #172B4D;
    --text-muted: #6B778C;
    --border: #DFE1E6;
    --border-light: #EBECF0;
    --success: #36B37E;
    --warning: #FFAB00;
    --danger: #FF5630;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
header {
    position: sticky;
    top: 0;
    background: var(--accent);
    color: #fff;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    max-width: 1900px;
    margin: 0 auto;
}

.header-bar h1 {
    font-size: 1.2rem;
    color: #fff;
    margin: 0;
}

.btn-logout {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.15);
}

/* Main content */
main {
    padding: 24px;
    max-width: 1900px;
    margin: 0 auto;
}

h1 {
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--text);
}

h2 {
    font-size: 1.1rem;
    margin: 0 0 12px;
    color: var(--text);
}

h2 .count {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Refresh section */
.refresh-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.refresh-status {
    font-size: 13px;
    color: var(--text-muted);
}

.refresh-status.success {
    color: var(--success);
}

.refresh-status.error {
    color: var(--danger);
}

/* Table sections */
.table-section {
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    padding: 20px;
    margin-bottom: 24px;
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

/* Jira table */
.jira-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.jira-table colgroup .col-ref { width: 110px; }
.jira-table colgroup .col-type { width: 80px; }
.jira-table colgroup .col-date { width: 100px; }
.jira-table colgroup .col-titre { width: 300px; }
.jira-table colgroup .col-statut { width: 100px; }
.jira-table colgroup .col-statut-interne { width: 200px; }
.jira-table colgroup .col-customer-ref { width: 240px; }
.jira-table colgroup .col-commentaire { width: auto; }

.jira-table thead th {
    background: var(--bg-light);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.jira-table thead th:hover {
    background: var(--border-light);
}

.jira-table thead th::after {
    content: '';
    display: inline-block;
    margin-left: 6px;
    width: 0;
    height: 0;
    vertical-align: middle;
}

.jira-table thead th.sort-asc::after {
    content: '▲';
    font-size: 9px;
    color: var(--accent);
}

.jira-table thead th.sort-desc::after {
    content: '▼';
    font-size: 9px;
    color: var(--accent);
}

.jira-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.jira-table tbody tr:hover {
    background: #F4F5F7;
}

.jira-table tbody td {
    padding: 10px 12px;
    vertical-align: top;
}

.jira-table .col-titre {
    max-width: 300px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Jira link */
.jira-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.jira-link:hover {
    text-decoration: underline;
}

/* Select statut interne */
.select-statut-interne {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    min-width: 140px;
}

.select-statut-interne:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.15);
}

/* Textarea commentaire */
.commentaire-interne {
    width: 100%;
    min-width: 300px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    font-size: 12px;
    font-family: inherit;
    color: var(--text);
    resize: vertical;
    min-height: 80px;
}

.commentaire-interne:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.15);
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    color: #fff;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); }
.btn-block { display: block; width: 100%; }

.btn:active {
    transform: scale(0.97);
}

/* Formulaires */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

/* Switch toggle */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.switch-group label {
    font-size: 14px;
    color: var(--text);
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    position: absolute;
    width: 44px;
    height: 24px;
    opacity: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    border: none;
    background: none;
}

.toggle .slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .slider {
    background: var(--accent);
}

.toggle input:checked + .slider::before {
    transform: translateX(20px);
}

/* Login page */
.login-container {
    max-width: 360px;
    margin: 80px auto;
    padding: 32px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.login-container h1 {
    margin-bottom: 24px;
    color: var(--accent);
}

.login-container .btn {
    margin-top: 16px;
}

/* Messages */
.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success { background: rgba(54,179,126,0.1); border: 1px solid var(--success); color: #1b6a47; }
.alert-error { background: rgba(255,86,48,0.1); border: 1px solid var(--danger); color: #cc3a22; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 12px;
    }
    
    .table-section {
        padding: 12px;
    }
    
    .header-bar {
        padding: 10px 16px;
    }
    
    .jira-table {
        font-size: 12px;
    }
}
