/* =====================================================
   Document Management System - Style.css
   ===================================================== */

/* =====================================================
   1. RESET & BASE STYLES
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* =====================================================
   2. HEADER STYLES
   ===================================================== */

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 5px;
}

header p {
    opacity: 0.9;
    font-size: 14px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-size: 14px;
    opacity: 0.95;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =====================================================
   3. NAVIGATION TABS
   ===================================================== */

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e1e8ed;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 2px;
}

.nav-tab {
    padding: 12px 24px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #657786;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-tab:hover {
    background: #f8f9fa;
    color: #667eea;
}

.nav-tab.active {
    background: white;
    color: #667eea;
    border-color: #e1e8ed;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
    position: relative;
    z-index: 1;
}

/* =====================================================
   4. TAB CONTENT
   ===================================================== */

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   5. CARD STYLES
   ===================================================== */

.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a202c;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

/* =====================================================
   6. FORM STYLES
   ===================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

label .required {
    color: #ef4444;
    margin-left: 3px;
    font-weight: 600;
}

input[type="text"],
input[type="date"],
input[type="file"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-upload-wrapper input[type="file"] {
    cursor: pointer;
}

/* Auto-generated fields */
.auto-generated {
    background: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-option label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

small {
    color: #6b7280;
    font-size: 12px;
}

/* =====================================================
   7. BUTTON STYLES
   ===================================================== */

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.action-btn {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0 3px;
    border-radius: 6px;
}

/* =====================================================
   8. TABLE STYLES
   ===================================================== */

.table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #f9fafb;
}

th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f9fafb;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* =====================================================
   9. STATUS BADGES
   ===================================================== */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-obsolete {
    background: #fee2e2;
    color: #991b1b;
}

.status-archived {
    background: #e5e7eb;
    color: #374151;
}

.status-withdrawn {
    background: #fecaca;
    color: #7f1d1d;
}

/* =====================================================
   10. STATS CARDS
   ===================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon-red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 5px;
}

/* =====================================================
   11. VERSION HISTORY
   ===================================================== */

.version-item {
    border-left: 3px solid #667eea;
    padding: 15px 20px;
    margin-bottom: 15px;
    background: #f9fafb;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.version-item:hover {
    background: #f3f4f6;
    border-left-width: 4px;
}

.version-number {
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
}

.version-date {
    color: #6b7280;
    font-size: 13px;
    margin-top: 5px;
}

.version-changes {
    margin-top: 10px;
    color: #374151;
    line-height: 1.6;
}

.version-changes strong {
    color: #1a202c;
}

/* =====================================================
   12. ALERT MESSAGES
   ===================================================== */

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

/* =====================================================
   13. SEARCH & FILTER SECTION
   ===================================================== */

.search-filter-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-filter-section .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.search-filter-section input,
.search-filter-section select {
    background: white;
}

/* =====================================================
   14. UTILITY CLASSES
   ===================================================== */

.text-danger {
    color: #ef4444;
    font-weight: 600;
}

.text-success {
    color: #10b981;
    font-weight: 600;
}

.text-warning {
    color: #f59e0b;
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

/* =====================================================
   15. RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    header p {
        font-size: 12px;
    }
    
    .card-header {
        font-size: 18px;
    }
    
    .nav-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* =====================================================
   16. PRINT STYLES
   ===================================================== */

@media print {
    header,
    .nav-tabs,
    .btn,
    .search-filter-section {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
    }
}

/* =====================================================
   17. SCROLLBAR STYLING (Webkit browsers)
   ===================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* =====================================================
   18. LOADING STATES
   ===================================================== */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =====================================================
   19. MODAL/POPUP STYLES (if needed)
   ===================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}

/* =====================================================
   20. CUSTOM ENHANCEMENTS
   ===================================================== */

/* Hover effect for clickable rows */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #f0f4ff !important;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1a202c;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Badge variations */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new {
    background: #dbeafe;
    color: #1e40af;
}

.badge-updated {
    background: #fef3c7;
    color: #92400e;
}

.badge-priority {
    background: #fee2e2;
    color: #991b1b;
}

/* File icon representation */
.file-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
}

.file-icon::before {
    content: "📄";
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Card with icon */
.card-with-icon {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

/* Divider */
.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 30px 0;
}

/* =====================================================
   END OF STYLESHEET
   ===================================================== */