/**
 * WebStation Portal - Main Stylesheet
 * DevExpress-style modern layout
 */

/* CSS Variables */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 60px;
    --topbar-height: 60px;
    --footer-height: 40px;
    --transition-speed: 0.3s;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* Layout Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed), transform var(--transition-speed);
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-search {
    display: none;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

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

.sidebar-toggle {
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.sidebar-search {
    padding: 12px 16px;
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    outline: none;
    transition: border-color 0.2s;
}

[dir="rtl"] .sidebar-search input {
    padding: 10px 12px 10px 36px;
}

.sidebar-search i {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

[dir="rtl"] .sidebar-search i {
    right: auto;
    left: 28px;
}

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

.nav-group {
    margin-bottom: 8px;
}

.nav-group-title {
    padding: 12px 16px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 2px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-item span {
    white-space: nowrap;
}

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

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

[dir="rtl"] .sidebar.collapsed ~ .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed-width);
}

/* Top Bar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.mobile-menu-toggle {
    display: none;
    padding: 8px;
    border-radius: 6px;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 200;
}

[dir="rtl"] .dropdown-menu {
    right: auto;
    left: 0;
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: block;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    transition: background-color 0.2s;
}

.dropdown-item i {
    margin-right: 8px;
}

[dir="rtl"] .dropdown-item i {
    margin-right: 0;
    margin-left: 8px;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px;
}

/* Footer */
.footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
}

.card-header {
    padding: 16px 20px;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-body {
    padding: 20px;
}

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

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

/* Stats Cards */
.stat-card {
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-content p {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* App Tiles */
.app-tile {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.app-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-hover);
}

.app-tile-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2rem;
}

.app-tile-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.app-tile-version {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 4px;
}

.app-tile-date {
    font-size: 0.8rem;
    opacity: 0.5;
    margin-bottom: 16px;
}

.app-tile-meta {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success { background: rgba(16, 185, 129, 0.1); color: #059669; }
.alert-error { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.alert-info { background: rgba(59, 130, 246, 0.1); color: #2563eb; }

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-info { background: rgba(59, 130, 246, 0.1); color: #2563eb; }

/* FAQ Accordion */
.faq-item {
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 16px 20px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
}

[dir="rtl"] .faq-question {
    text-align: right;
}

.faq-question i {
    transition: transform 0.2s;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s, padding 0.3s;
}

.faq-item.active .faq-answer {
    padding: 0 20px 16px;
    max-height: 200px;
}

/* Support Cards */
.support-card {
    padding: 24px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: transform 0.2s;
}

.support-card:hover {
    transform: translateY(-4px);
}

.support-card i {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.support-card h3 {
    margin-bottom: 8px;
}

.support-card p {
    opacity: 0.7;
    margin-bottom: 16px;
}

/* Login Form */
.login-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 24px;
}

.login-container .logo {
    justify-content: center;
    margin-bottom: 24px;
    font-size: 1.5rem;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* Responsive */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .mobile-menu-toggle {
        display: flex;
    }

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

    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
