/* Modern Dashboard CSS for Dytatek Systems */
/* Color variables are defined in colors.css */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

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

body:has(.login-container) {
    overflow: hidden;
}

/* App Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: var(--radius-md);
    color: var(--btn-primary-text);
}

.brand-text {
    flex: 1;
}

.brand-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-top: 2px;
    font-weight: 500;
}

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

.nav-section {
    margin-bottom: 32px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 16px;
    margin-bottom: 8px;
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
    margin: 2px 8px;
    border-radius: var(--radius-md);
}

.nav-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: var(--sidebar-active);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: inherit;
}

.nav-label {
    font-weight: inherit;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--btn-primary-text);
    flex-shrink: 0;
}

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

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: capitalize;
    font-weight: 400;
    line-height: 1.3;
}

.logout-item {
    border-left: none;
    padding: 10px 16px;
    color: var(--text-secondary);
    margin: 2px 8px;
}

.logout-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 200px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.content-wrapper {
    flex: 1;
    padding: 32px;
}

.main-footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 20px 32px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Container (for non-authenticated pages) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

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

.table th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

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

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-danger:hover {
    background-color: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid;
    font-size: 14px;
}

.alert-success {
    background-color: var(--alert-success-bg);
    color: var(--alert-success-text);
    border-color: var(--alert-success-border);
}

.alert-error {
    background-color: var(--alert-error-bg);
    color: var(--alert-error-text);
    border-color: var(--alert-error-border);
}

/* Headings */
h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.3;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 32px;
    line-height: 1.4;
}

h2:first-of-type {
    margin-top: 0;
}

/* Site Details */
.site-details {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.site-details .table {
    margin-bottom: 32px;
}

.site-details .table:last-child {
    margin-bottom: 0;
}

/* Detail Tables (key-value pairs) */
.table tbody tr th {
    background-color: transparent;
    font-weight: 600;
    color: var(--text-secondary);
    width: 200px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
}

.table tbody tr td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

/* Log Viewer */
.log-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.log-viewer {
    background: var(--log-viewer-bg);
    color: var(--log-viewer-text);
    padding: 20px;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.log-viewer pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* FTP Info */
.ftp-info {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Code */
code {
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

.table a {
    font-weight: 500;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    background-image: url('https://images.unsplash.com/photo-1760865245434-051dbb0de65e?q=80&w=3270&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    z-index: 9999;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-light);
    backdrop-filter: blur(1px);
}

.login-box {
    background: var(--bg-login-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 36px 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-login-box);
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-light);
}

.login-icon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.login-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-login-icon);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 18px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.login-subtitle {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.login-form {
    margin-bottom: 0;
}

.form-group-icon {
    position: relative;
    margin-bottom: 16px;
}

.form-group-icon .form-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    z-index: 1;
}

.form-group-icon input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group-icon input:focus {
    outline: none;
    border-color: var(--input-focus-border);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.form-group-icon input::placeholder {
    color: var(--text-placeholder);
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    z-index: 1;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.btn-login-primary {
    width: 100%;
    padding: 12px 24px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-top: 8px;
}

.btn-login-primary:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-button);
}

.btn-login-primary:active {
    transform: translateY(0);
}

.login-box .alert {
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background-color: var(--badge-active-bg);
    color: var(--badge-active-text);
}

.status-pending {
    background-color: var(--badge-pending-bg);
    color: var(--badge-pending-text);
}

.status-completed {
    background-color: var(--badge-completed-bg);
    color: var(--badge-completed-text);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 16px;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Bootstrap Icons adjustments */
.bi {
    display: inline-block;
    vertical-align: -0.125em;
}

/* Card Sections */
.card-section {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.card-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* Page Header Actions */
.page-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
    gap: 12px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Utility Classes */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

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

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 16px; }
