/* KoshaPlan - Professional ERP Styling */

/* Color Palette - SAP-inspired */
:root {
    --primary-color: #0070f3;
    --primary-dark: #0051bb;
    --primary-light: #e6f2ff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;

    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-dark: #2c3e50;

    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-light: #ffffff;

    --border-color: #dee2e6;
    --border-light: #e9ecef;

    --nav-height: 50px;
    --breadcrumb-height: 35px;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Top Navigation Bar */
.top-nav {
    background-color: var(--bg-dark);
    height: var(--nav-height);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    margin-right: 40px;
    height: 100%;
}

.brand-logo {
    background-color: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.brand-name {
    color: white;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 1;
    height: 100%;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: stretch;
}

.nav-button {
    background: none;
    border: none;
    color: white;
    padding: 0 16px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
    white-space: nowrap;
    text-decoration: none;
    height: 100%;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-icon {
    font-size: 16px;
}

.dropdown-arrow {
    font-size: 10px;
    margin-left: 2px;
}

/* Dropdown Content */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 5px;
    z-index: 1001;
}

.dropdown-content.dropdown-right {
    left: auto;
    right: 0;
}

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

.dropdown-content a {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.dropdown-content a.disabled {
    color: #9ca3af;
    background-color: #f9fafb;
    cursor: not-allowed;
    pointer-events: none;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-light);
    margin: 5px 0;
}

/* User Section */
.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

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

.user-name {
    font-size: 13px;
}

/* Organization Selector */
.org-selector {
    margin-right: 15px;
}

.org-button {
    background-color: rgba(255, 255, 255, 0.08);
    border: none;
}

.org-button:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.org-icon {
    font-size: 18px;
}

.org-name {
    font-size: 13px;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-org-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 15px;
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    height: 100%;
}

.org-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.org-option.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.org-check {
    width: 16px;
    text-align: center;
    color: var(--success-color);
    font-weight: bold;
}

.user-info-header {
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    margin: -1px -1px 0 -1px;
    border-radius: 4px 4px 0 0;
}

.user-info-header small {
    color: var(--text-secondary);
    font-size: 11px;
}

/* Breadcrumb */
.breadcrumb {
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
    margin-top: var(--nav-height);
    position: sticky;
    top: var(--nav-height);
    z-index: 999;
}

.breadcrumb span {
    color: var(--text-secondary);
    font-size: 12px;
}

.breadcrumb span:not(:last-child)::after {
    content: " / ";
    margin: 0 8px;
}

/* Main Content */
.main-content {
    padding: 20px 0;
    min-height: calc(100vh - var(--nav-height) - var(--breadcrumb-height) - 60px);
}

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

/* Messages/Alerts */
.messages {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: var(--success-color);
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: var(--danger-color);
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: var(--warning-color);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: var(--info-color);
}

/* Page Header */
.page-header {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

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

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

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

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

.btn-outline {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--bg-secondary);
}

/* View Tabs */
.view-tabs {
    background-color: white;
    padding: 0 20px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    display: flex;
    gap: 5px;
}

.view-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.view-tab:hover {
    color: var(--primary-color);
}

.view-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Card */
.card {
    background-color: white;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
}

.card-body {
    padding: 20px;
}

/* Table */
.table-container {
    background-color: white;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table thead {
    background-color: var(--bg-tertiary);
}

.table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background-color: var(--primary-light);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Form */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

select.form-control {
    background-color: white;
    cursor: pointer;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Footer */
.footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 15px 0;
    margin-top: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 10px;
}

.mt-2 {
    margin-top: 20px;
}

.mb-1 {
    margin-bottom: 10px;
}

.mb-2 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

/* Spreadsheet-like grid (for inline editing) */
.grid-table {
    overflow-x: auto;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.grid-table input {
    border: none;
    padding: 8px;
    width: 100%;
    font-size: 13px;
}

.grid-table input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}
