/* =====================================================
   NEXURAPLANT - Hauptstylesheet
   ===================================================== */

/* CSS Variables */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #3b82f6;
    
    --color-success: #16a34a;
    --color-warning: #ca8a04;
    --color-danger: #dc2626;
    --color-info: #0891b2;
    
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
    --header-height: 60px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-gray-800);
    background-color: var(--color-gray-100);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =====================================================
   APP LAYOUT
   ===================================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.2s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--color-gray-700);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-text {
    font-weight: 600;
    font-size: 1.125rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--color-gray-300);
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-nav li a:hover {
    background: var(--color-gray-800);
    color: white;
}

.sidebar-nav li a.active {
    background: var(--color-primary);
    color: white;
}

.sidebar-nav .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: var(--color-gray-700);
    margin: 0.5rem 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--color-gray-500);
    display: flex;
}

.search-form {
    position: relative;
}

.search-input {
    width: 300px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-name {
    font-weight: 500;
    color: var(--color-gray-700);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    display: none;
}

.user-dropdown.open {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--color-gray-700);
    text-decoration: none;
}

.user-dropdown a:hover {
    background: var(--color-gray-50);
}

.page-content {
    flex: 1;
    padding: 1.5rem;
}

/* =====================================================
   AUTH PAGES
   ===================================================== */

.auth-page {
    background: linear-gradient(135deg, var(--color-gray-900) 0%, var(--color-gray-800) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.auth-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.auth-logo .logo-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.auth-logo .logo-text {
    font-size: 1.5rem;
    color: var(--color-gray-900);
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--color-gray-500);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

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

.auth-links {
    text-align: center;
    margin-top: 1rem;
}

.auth-links a {
    font-size: 0.875rem;
    color: var(--color-gray-500);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--color-gray-400);
    font-size: 0.75rem;
}

/* =====================================================
   FORMS
   ===================================================== */

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

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

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group .form-hint {
    font-size: 0.75rem;
    color: var(--color-gray-500);
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: var(--color-danger);
}

.form-group .error-message {
    font-size: 0.75rem;
    color: var(--color-danger);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: white;
    border-color: var(--color-gray-300);
    color: var(--color-gray-700);
}

.btn-secondary:hover {
    background: var(--color-gray-50);
}

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

.btn-danger:hover {
    background: #b91c1c;
}

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

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 0.5rem;
}

.btn .icon {
    width: 18px;
    height: 18px;
}

/* =====================================================
   FLASH MESSAGES
   ===================================================== */

.flash-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.flash-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    padding: 0.25rem;
}

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

/* =====================================================
   CARDS
   ===================================================== */

.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-gray-200);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray-900);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* =====================================================
   TABLES
   ===================================================== */

.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-200);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-500);
    background: var(--color-gray-50);
}

.table tbody tr:hover {
    background: var(--color-gray-50);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* =====================================================
   STATUS BADGES
   ===================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.status-blue { background: #dbeafe; color: #1e40af; }
.status-yellow { background: #fef3c7; color: #92400e; }
.status-orange { background: #ffedd5; color: #9a3412; }
.status-green { background: #dcfce7; color: #166534; }
.status-red { background: #fee2e2; color: #991b1b; }
.status-purple { background: #f3e8ff; color: #6b21a8; }
.status-gray { background: #f3f4f6; color: #374151; }

.priority-urgent { color: var(--color-danger); }
.priority-high { color: #ea580c; }
.priority-normal { color: var(--color-warning); }
.priority-low { color: var(--color-success); }

.criticality-critical { color: var(--color-danger); font-weight: 600; }
.criticality-high { color: #ea580c; }
.criticality-normal { color: var(--color-gray-600); }
.criticality-low { color: var(--color-gray-400); }

/* =====================================================
   PAGE HEADER
   ===================================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-gray-900);
}

.breadcrumbs {
    margin-bottom: 0.5rem;
}

.breadcrumbs ol {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    font-size: 0.875rem;
}

.breadcrumbs li:not(:last-child)::after {
    content: '/';
    margin-left: 0.5rem;
    color: var(--color-gray-400);
}

.breadcrumbs a {
    color: var(--color-gray-500);
}

.breadcrumbs .current {
    color: var(--color-gray-900);
}

/* =====================================================
   DASHBOARD WIDGETS
   ===================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--color-gray-200);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

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

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-gray-900);
}

.stat-card-footer {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-top: 0.5rem;
}

/* =====================================================
   UTILITIES
   ===================================================== */

.text-muted { color: var(--color-gray-500); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.hidden { display: none; }

.icon {
    display: inline-block;
    vertical-align: middle;
}

/* Form Input/Select Base Styles (for filter forms) */
.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .search-input {
        width: 200px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
