/* AWAKS Sign - Styles */
/* Design System */

:root {
    /* Couleurs AWAKS */
    --primary: #E67E22;
    --primary-dark: #D35400;
    --primary-light: #F39C12;
    --accent: #E67E22;
    --sidebar-bg: #1a365d;
    --sidebar-hover: #2c5282;
    --sidebar-active: #E67E22;
    /* Autres couleurs */
    --bg-dark: #1a365d;
    --bg-light: #f7fafc;
    --bg-card: #ffffff;
    --text-dark: #1a202c;
    --text-muted: #718096;
    --border: #e2e8f0;
    --success: #38a169;
    --warning: #dd6b20;
    --danger: #e53e3e;
    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --font-main: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--text-dark);
    background: var(--bg-light);
    line-height: 1.5;
}

/* App Layout */
#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    overflow-y: auto;
    border-right: 4px solid var(--primary);
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.notification-bell {
    cursor: pointer;
    font-size: 18px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.nav-item.active {
    background: rgba(230, 126, 34, 0.1);
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item.active .nav-icon svg {
    stroke: var(--primary);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.notification-bell {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.notification-bell:hover {
    opacity: 1;
}

.notification-bell svg {
    width: 20px;
    height: 20px;
}

.nav-text {
    flex: 1;
}

.nav-badge {
    background: var(--warning);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.nav-separator {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 16px;
    letter-spacing: 1px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

.logout-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.version {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay.hidden {
    display: none;
}

.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #fff;
}

.login-logo-icon svg {
    width: 32px;
    height: 32px;
}

.login-logo h1 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check label {
    cursor: pointer;
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.4);
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--border);
}

.forgot-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.forgot-link:hover {
    color: var(--primary);
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.stat-change {
    font-size: 12px;
    margin-top: 8px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: var(--bg-light);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-gray {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

/* Reference mono */
.ref {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--danger);
}

/* Form Select */
.form-group select,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Form Textarea */
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-main);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Form File Input */
.form-group input[type="file"] {
    padding: 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s;
}

.form-group input[type="file"]:hover {
    border-color: var(--primary);
}

/* Chart */
.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 20px 0;
    gap: 10px;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
}

.chart-bar {
    width: 100%;
    max-width: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 4px;
    transition: all 0.3s;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-value {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px;
}

.chart-label {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Template Selection */
.template-search-bar {
    margin-bottom: 20px;
}

.template-search-bar input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 15px;
    transition: all 0.2s;
}

.template-search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

.template-table .template-row {
    cursor: pointer;
    transition: all 0.2s;
}

.template-table .template-row:hover {
    background: rgba(230, 126, 34, 0.05);
}

.template-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.template-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Editor back button */
.editor-back {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--border);
    color: var(--text-dark);
}

.selected-template {
    font-weight: 600;
    color: var(--primary);
}

/* Contract Editor Split Screen */
.contract-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.editor-form {
    position: sticky;
    top: 24px;
}

.editor-preview {
    position: sticky;
    top: 24px;
}

.preview-card {
    background: #fff;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.preview-badge {
    background: var(--success);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.preview-content {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 20px;
    min-height: 400px;
}

/* Preview Document Style */
.preview-document {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.preview-doc-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary);
}

.preview-doc-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.preview-doc-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.preview-doc-section {
    margin-bottom: 20px;
}

.preview-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.preview-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dotted var(--border);
}

.preview-label {
    color: var(--text-muted);
    font-size: 13px;
}

.preview-value {
    font-weight: 500;
    color: var(--text-dark);
    text-align: right;
}

.preview-placeholder {
    color: var(--primary);
    font-style: italic;
    font-size: 12px;
}

.preview-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
}

.preview-sig-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.preview-sig-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.preview-sig-name {
    font-weight: 600;
    margin-bottom: 12px;
}

.preview-sig-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
}

.preview-paraphe {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.preview-paraphe-zone {
    display: inline-block;
    border-bottom: 1px solid var(--text-muted);
    min-width: 60px;
}

/* Form Sections */
.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin: 24px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* Input with suffix */
.input-with-suffix {
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-suffix {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-left: none;
    padding: 12px 16px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
}

/* Signature zones info */
.signature-zones-info {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sig-info-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 8px;
}

.sig-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.sig-signature {
    background: var(--primary);
    color: #fff;
}

.sig-paraphe {
    background: #8b5cf6;
    color: #fff;
}

.sig-signature_awaks {
    background: var(--sidebar-bg);
    color: #fff;
}

/* Checkbox custom */
.form-group-checkbox {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.checkbox-label:hover {
    border-color: var(--primary);
    background: #fff;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 4px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-text {
    font-size: 14px;
    color: var(--text-dark);
}

@media (max-width: 1024px) {
    .contract-editor {
        grid-template-columns: 1fr;
    }

    .editor-preview {
        order: -1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
