/* ============================================
   JJ Referat Dokumenter - Frontend Styles
   Version 1.0 - Matches JJ Lager System design
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    --jj-primary: #4CAF50;
    --jj-primary-dark: #43A047;
    --jj-primary-light: #C8E6C9;
    --jj-primary-bg: #E8F5E9;
    --jj-text-dark: #1f2937;
    --jj-text-gray: #6b7280;
    --jj-border: #e5e7eb;
    --jj-bg-light: #f8fafc;
    --jj-white: #ffffff;
    --jj-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --jj-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --jj-radius: 8px;
    --jj-radius-lg: 16px;
    --jj-danger: #ef4444;
    --jj-danger-light: #fee2e2;
}

/* ===== GLOBAL RESET ===== */
.jj-referat-wrapper *,
.jj-referat-wrapper *::before,
.jj-referat-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== MAIN WRAPPER ===== */
.jj-referat-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--jj-text-dark);
    line-height: 1.5;
}

/* ===== HEADER ===== */
.jj-referat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.jj-referat-header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--jj-text-dark);
    margin: 0 0 4px 0;
}

.jj-referat-header-left p {
    font-size: 0.9rem;
    color: var(--jj-text-gray);
    margin: 0;
}

/* ===== TOOLBAR ===== */
.jj-referat-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: var(--jj-white);
    border-radius: var(--jj-radius);
    box-shadow: var(--jj-shadow);
    margin-bottom: 24px;
}

.jj-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 500px;
}

.jj-search-wrapper .jj-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--jj-text-gray);
    pointer-events: none;
}

.jj-search-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--jj-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.jj-search-wrapper input:focus {
    border-color: var(--jj-primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.jj-search-wrapper input::placeholder {
    color: #9ca3af;
}

/* ===== BUTTONS ===== */
.jj-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--jj-radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.jj-btn-icon {
    font-size: 16px;
}

.jj-btn-primary {
    background: var(--jj-primary) !important;
    color: #ffffff !important;
}

.jj-btn-primary:hover {
    background: var(--jj-primary-dark) !important;
    color: #ffffff !important;
}

.jj-btn-secondary {
    background: var(--jj-bg-light);
    color: var(--jj-text-dark);
    border: 1px solid var(--jj-border);
}

.jj-btn-secondary:hover {
    background: #e5e7eb;
}

.jj-btn-danger {
    background: var(--jj-danger);
    color: white;
    padding: 10px 14px;
}

.jj-btn-danger:hover {
    background: #dc2626;
}

/* ===== DOCUMENTS GRID ===== */
.jj-referat-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.jj-referat-empty {
    background: var(--jj-white);
    border-radius: var(--jj-radius-lg);
    padding: 60px 40px;
    text-align: center;
    box-shadow: var(--jj-shadow);
}

.jj-empty-icon {
    margin-bottom: 16px;
    color: var(--jj-text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jj-empty-icon svg {
    stroke: #9ca3af;
}

.jj-referat-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--jj-text-dark);
    margin-bottom: 8px;
}

.jj-referat-empty p {
    color: var(--jj-text-gray);
    margin: 0;
}

/* ===== DOCUMENT CARD ===== */
.jj-referat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--jj-white);
    border-radius: var(--jj-radius-lg);
    padding: 20px 24px;
    box-shadow: var(--jj-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.jj-referat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--jj-shadow-lg);
}

.jj-referat-card-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--jj-primary-bg);
    border-radius: 12px;
    color: var(--jj-primary);
}

.jj-referat-card-icon svg {
    stroke: var(--jj-primary);
}

.jj-referat-card-content {
    flex: 1;
    min-width: 0;
}

.jj-referat-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--jj-text-dark);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jj-referat-subtitle {
    font-size: 0.875rem;
    color: var(--jj-text-gray);
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jj-referat-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--jj-text-gray);
}

.jj-referat-separator {
    color: var(--jj-border);
}

.jj-referat-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.jj-btn-view {
    padding: 10px 20px !important;
    background: #4CAF50 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    display: inline-block !important;
}

.jj-btn-view:hover {
    background: #43A047 !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.jj-btn-view:link,
.jj-btn-view:visited,
.jj-btn-view:active {
    color: #ffffff !important;
    text-decoration: none !important;
}

.jj-btn-delete {
    padding: 10px 16px !important;
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
}

.jj-btn-delete:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
}

.jj-btn-delete:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ===== LOCKED STATE ===== */
.jj-referat-locked {
    background: var(--jj-white);
    border-radius: var(--jj-radius-lg);
    padding: 80px 40px;
    text-align: center;
    box-shadow: var(--jj-shadow);
    max-width: 500px;
    margin: 0 auto;
}

.jj-locked-icon {
    margin-bottom: 24px;
    color: var(--jj-text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jj-locked-icon svg {
    stroke: #9ca3af;
}

.jj-referat-locked h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--jj-text-dark);
    margin: 0 0 8px 0;
}

.jj-referat-locked p {
    color: var(--jj-text-gray);
    margin: 0 0 24px 0;
}

.jj-locked-hint {
    font-size: 0.85rem !important;
    opacity: 0.7;
}

/* ===== MODAL ===== */
.jj-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jj-modal.is-active {
    display: flex;
}

.jj-modal-content {
    background: var(--jj-white);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.jj-modal-small {
    max-width: 400px;
}

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

.jj-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--jj-text-dark);
}

.jj-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--jj-text-gray);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.jj-modal-close:hover {
    background: var(--jj-bg-light);
    color: var(--jj-text-dark);
}

.jj-modal-body {
    padding: 24px;
}

.jj-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--jj-border);
    background: var(--jj-bg-light);
    border-radius: 0 0 12px 12px;
}

/* ===== FORM STYLES ===== */
.jj-form-group {
    margin-bottom: 20px;
}

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

.jj-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--jj-text-dark);
    margin-bottom: 6px;
}

.jj-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--jj-border);
    border-radius: var(--jj-radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.jj-input:focus {
    outline: none;
    border-color: var(--jj-primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.jj-form-hint {
    font-size: 12px;
    color: var(--jj-text-gray);
    margin-top: 6px;
}

/* ===== FILE UPLOAD ===== */
.jj-file-upload-area {
    position: relative;
    border: 2px dashed var(--jj-border);
    border-radius: var(--jj-radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--jj-bg-light);
}

.jj-file-upload-area:hover,
.jj-file-upload-area.jj-drag-over {
    border-color: var(--jj-primary);
    background: var(--jj-primary-bg);
}

.jj-file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.jj-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.jj-upload-icon {
    color: var(--jj-text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jj-upload-icon svg {
    stroke: var(--jj-text-gray);
}

.jj-upload-text {
    font-weight: 500;
    color: var(--jj-text-dark);
}

.jj-upload-hint {
    font-size: 12px;
    color: var(--jj-text-gray);
}

.jj-file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--jj-white);
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid var(--jj-border);
}

.jj-file-icon {
    color: var(--jj-primary);
    display: flex;
    align-items: center;
}

.jj-file-icon svg {
    stroke: var(--jj-primary);
}

.jj-file-name {
    flex: 1;
    font-weight: 500;
    color: var(--jj-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jj-file-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--jj-danger);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.jj-file-remove:hover {
    background: #dc2626;
}

/* ===== PROGRESS BAR ===== */
.jj-upload-progress {
    margin-top: 16px;
}

.jj-progress-bar {
    height: 8px;
    background: var(--jj-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.jj-progress-fill {
    height: 100%;
    background: var(--jj-primary);
    border-radius: 4px;
    width: 0;
    transition: width 0.3s;
}

.jj-progress-text {
    font-size: 12px;
    color: var(--jj-text-gray);
}

/* ===== FORM MESSAGES ===== */
.jj-form-message {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 16px;
}

.jj-form-message.success {
    background: var(--jj-primary-bg);
    color: #1B5E20;
    border-left: 4px solid var(--jj-primary);
}

.jj-form-message.error {
    background: var(--jj-danger-light);
    color: #991b1b;
    border-left: 4px solid var(--jj-danger);
}

/* ===== TEXT HELPERS ===== */
.jj-text-muted {
    color: var(--jj-text-gray);
    font-size: 13px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .jj-referat-wrapper {
        padding: 20px 16px;
    }
    
    .jj-referat-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .jj-referat-header-right {
        width: 100%;
    }
    
    .jj-referat-header-right .jj-btn {
        width: 100%;
        justify-content: center;
    }
    
    .jj-referat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
    }
    
    .jj-referat-card-content {
        width: 100%;
    }
    
    .jj-referat-title {
        white-space: normal;
    }
    
    .jj-referat-subtitle {
        white-space: normal;
    }
    
    .jj-referat-card-actions {
        width: 100%;
    }
    
    .jj-btn-view {
        flex: 1;
    }
    
    .jj-modal-content {
        max-height: 85vh;
    }
    
    .jj-modal-footer {
        flex-direction: column-reverse;
    }
    
    .jj-modal-footer .jj-btn {
        width: 100%;
    }
    
    .jj-search-wrapper {
        max-width: none;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.jj-referat-card {
    animation: fadeIn 0.3s ease-out;
}

/* ===== PRINT STYLES ===== */
@media print {
    .jj-referat-header-right,
    .jj-referat-toolbar,
    .jj-referat-card-actions,
    .jj-modal {
        display: none !important;
    }
    
    .jj-referat-wrapper {
        padding: 0;
    }
    
    .jj-referat-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
