/* Base Styles */
:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f6fa;
    --white: #fff;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --sidebar-width: 250px;
    --header-height: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--bg-color);
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 20px;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--white);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.sidebar-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
}

.search-form {
    display: flex;
    max-width: 400px;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    padding: 8px 15px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.header-user {
    position: relative;
}

.user-name {
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 4px;
}

.user-name:hover {
    background: var(--bg-color);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: 4px;
    min-width: 150px;
    z-index: 1001;
}

.header-user:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
}

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

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 5px 0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--white);
    box-shadow: var(--shadow);
    overflow-y: auto;
    z-index: 999;
}

.nav-menu {
    list-style: none;
    padding: 15px 0;
}

.nav-section {
    padding: 15px 20px 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--bg-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: var(--white);
}

/* Footer */
.main-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    padding: 10px 20px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.subdomain-info {
    color: var(--text-light);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

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

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

.form-control:focus {
    border-color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
}

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

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

.btn-block {
    display: block;
    width: 100%;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

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

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fdeaea;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.alert-success {
    background: #eafaf1;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

/* Dashboard */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-section {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
}

.dashboard-section h2 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: var(--bg-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s;
}

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

.empty-state {
    color: var(--text-light);
    text-align: center;
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

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

    .main-content {
        margin-left: 0;
    }

    .main-footer {
        left: 0;
    }

    .header-center {
        display: none;
    }
}
