/* DocPortal - Main Stylesheet */

:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --secondary: #4a5568;
    --success: #38a169;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --info: #3182ce;
    --light: #f7fafc;
    --dark: #1a202c;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo i {
    font-size: 1.5rem;
    color: #f6ad55;
}

.subtitle {
    font-size: 0.875rem;
    opacity: 0.8;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
}

.user-name {
    font-weight: 500;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--info);
    color: var(--white);
}

.badge-danger {
    background: var(--danger);
    color: var(--white);
}

.badge-success {
    background: var(--success);
    color: var(--white);
}

.badge-secondary {
    background: var(--gray-500);
    color: var(--white);
}

.badge-login { background: var(--success); color: white; }
.badge-download { background: var(--info); color: white; }
.badge-view { background: var(--gray-500); color: white; }

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 1.5rem;
}

.welcome-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.welcome-section p {
    color: var(--gray-600);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.orange { background: #fed7aa; color: #ea580c; }
.stat-icon.purple { background: #e9d5ff; color: #9333ea; }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 i {
    color: var(--gray-400);
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-right {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* Forms */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group.flex-2 {
    flex: 2;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.input-icon input {
    padding-left: 2.5rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Quick Access */
.quick-access {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--info);
    color: var(--white);
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-outline {
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    color: var(--gray-500);
    border: 1px solid transparent;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-icon.active {
    background: var(--info);
    color: var(--white);
}

.btn-download {
    color: var(--warning);
}

.btn-download:hover {
    background: #fef3c7;
}

.btn-block {
    width: 100%;
}

/* Documents List */
.documents-list {
    display: flex;
    flex-direction: column;
}

.document-row {
    display: flex;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 1rem;
}

.document-row:last-child {
    border-bottom: none;
}

.doc-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-icon.pdf { background: #fee2e2; color: #dc2626; }
.doc-icon.doc, .doc-icon.docx { background: #dbeafe; color: #2563eb; }
.doc-icon.xls, .doc-icon.xlsx { background: #d1fae5; color: #059669; }
.doc-icon.dwg { background: #fed7aa; color: #ea580c; }
.doc-icon i { font-size: 1.125rem; }

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 500;
    color: var(--gray-800);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-tags {
    display: flex;
    gap: 0.375rem;
}

.tag {
    padding: 0.25rem 0.5rem;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
}

.doc-size, .doc-date {
    font-size: 0.875rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.doc-size {
    min-width: 80px;
}

.doc-date {
    min-width: 90px;
}

.doc-actions {
    display: flex;
    gap: 0.25rem;
}

/* Activity Log */
.activity-log {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.log-item {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.log-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.log-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.log-icon.login { background: #d1fae5; color: #059669; }
.log-icon.download { background: #dbeafe; color: #2563eb; }
.log-icon.view { background: var(--gray-100); color: var(--gray-500); }

.log-content {
    flex: 1;
    min-width: 0;
}

.log-user {
    font-weight: 500;
    color: var(--gray-800);
}

.log-badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.log-doc {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

.log-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.log-ip {
    margin-left: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

.loading i {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Alerts */
.flash-messages {
    position: fixed;
    top: 70px;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Footer */
.footer {
    background: var(--white);
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
    border-top: 1px solid var(--gray-200);
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .document-row {
        flex-wrap: wrap;
    }
    
    .doc-tags, .doc-size, .doc-date {
        display: none;
    }
    
    .header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .subtitle {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
