/* ========================================
   FONTS
   ======================================== */

@font-face {
    font-family: 'PrimeSites';
    src: url('PrimeSites.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* ========================================
   GENERIC APP TEMPLATE - CUSTOMIZABLE COLOR SCHEME
   ======================================== 
   
   To customize colors for a new project:
   1. Update the CSS variables in the :root section below
   2. Update the dark mode overrides in body.dark-mode section
   3. All colors throughout the app will automatically update
   
   Key variables to change:
   - --color-primary: Main brand color (buttons, accents)
   - --color-primary-hover: Hover state for primary elements
   - --color-link-primary: Default link color
   - --color-link-hover: Link hover color
   - --gradient-bg-light: Light mode background gradient
   - --gradient-bg-dark: Dark mode background gradient
   - --gradient-dev-banner: Development banner gradient
   
   ======================================== */

/* ========================================
   COLOR SCHEME VARIABLES
   ======================================== */
/* Prevent flash of unstyled content */
body {
    visibility: hidden;
}

body.loaded {
    visibility: visible;
}

:root {
  /* Primary Brand Colors */
  --color-primary: #EF3937;           /* Blue accent */
  --color-primary-hover: #9ab;    /* Darker blue hover */
  --color-primary-dark: #4c0202;         /* Darker blue for dark mode */
  
  /* Background Colors */
  --color-bg-primary: #ffffff;        /* White background */
  --color-bg-secondary: #f8f9fa;     /* Light grey background */
  --color-bg-tertiary: #e9ecef;      /* Lighter grey background */
  --color-bg-form: #ffffff;           /* Form background */
  
  /* Text Colors */
  --color-text-primary: #000000;      /* Black text */
  --color-text-secondary: #333333;    /* Dark grey text */
  --color-text-tertiary: #666666;    /* Medium grey text */
  --color-text-muted: #888888;       /* Muted grey text */
  --color-text-light: #aaaaaa;       /* Light grey text */
  
  /* Border Colors */
  --color-border-primary: #dddddd;   /* Light border */
  --color-border-secondary: #cccccc; /* Medium border */
  --color-border-tertiary: #eeeeee; /* Very light border */
  
  /* Link Colors */
  --color-link-primary: #348FE0;      /* Blue links */
  --color-link-hover: #3282CA;       /* Darker blue hover */
  
  /* Status Colors */
  --color-success: #28a745;          /* Green success */
  --color-warning: #ffc107;          /* Yellow warning */
  --color-error: #dc3545;            /* Red error */
  
  /* Form Colors */
  --color-input-bg: #ffffff;         /* Input background */
  --color-input-border: #dddddd;     /* Input border */
  --color-input-disabled-bg: #f0f0f0; /* Disabled input bg */
  --color-input-disabled-text: #a0a0a0; /* Disabled input text */
  
  /* Shadow Colors */
  --color-shadow-light: rgba(0, 0, 0, 0.1);
  --color-shadow-medium: rgba(0, 0, 0, 0.2);
  --color-shadow-dark: rgba(0, 0, 0, 0.5);
  
  /* Gradient Colors */
  --gradient-bg-light: radial-gradient(circle at center, #ffffff, #C5D9EC, #AFCFED 100%);
  --gradient-bg-dark: radial-gradient(circle at center,#4c0202 0%,#000000 100%);
  --gradient-dev-banner: linear-gradient(90deg, #111, #222);
  --gradient-test-banner: linear-gradient(90deg, #1a1a2e, #16213e);
}

/* Dark Mode Color Overrides */
body.dark-mode {
  /* Background Colors */
  --color-bg-primary: #000000;       /* Black background */
  --color-bg-secondary: #24303E;     /* Dark grey background */
  --color-bg-tertiary: #293848;       /* Medium dark grey */
  --color-bg-form: rgba(0, 0, 0, 0.4); /* Semi-transparent form */
  
  /* Text Colors */
  --color-text-primary: #e0e0e0;     /* Light text */
  --color-text-secondary: #ffffff;   /* White text */
  --color-text-tertiary: #aaaaaa;    /* Light grey text */
  --color-text-muted: #aaaaaa;       /* Muted light grey */
  --color-text-light: #888888;       /* Darker light grey */
  
  /* Border Colors */
  --color-border-primary: #666666;   /* Dark border */
  --color-border-secondary: #555555; /* Darker border */
  --color-border-tertiary: #444444; /* Darkest border */
  
  /* Link Colors */
  --color-link-primary: #4a9eff;     /* Light blue links */
  --color-link-hover: #66b3ff;       /* Lighter blue hover */
  
  /* Form Colors */
  --color-input-bg: rgba(0, 0, 0, 0.3); /* Semi-transparent input */
  --color-input-border: #666666;     /* Dark input border */
  --color-input-disabled-bg: rgba(0, 0, 0, 0.2);
  --color-input-disabled-text: #666666;
  
  /* Shadow Colors */
  --color-shadow-light: rgba(255, 255, 255, 0.1);
  --color-shadow-medium: rgba(255, 255, 255, 0.2);
  --color-shadow-dark: rgba(255, 255, 255, 0.3);
}

/* ========================================
   BASE STYLES
   ======================================== */

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

body {
    font-family: 'Open Sans', sans-serif;
    background: var(--gradient-bg-light);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    background: var(--gradient-bg-dark);
}

/* ========================================
   DEVELOPMENT BANNER
   ======================================== */

.dev-banner {
    background: var(--gradient-dev-banner);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: bold;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.test-banner {
    background: var(--gradient-test-banner);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: bold;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

body.has-dev-banner {
    padding-top: 40px;
}

body.has-test-banner {
    padding-top: 40px;
}

/* ========================================
   FORM CONTAINER
   ======================================== */

.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: var(--color-bg-form);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--color-shadow-light);
    margin-top: 20px;
    margin-bottom: 20px;
}

body.dark-mode .form-container {
    background: var(--color-bg-form);
    box-shadow: 0 4px 6px var(--color-shadow-light);
}

/* ========================================
   LOGO STYLES
   ======================================== */

.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    max-height: 60px;
    max-width: 200px;
    height: auto;
    width: auto;
}

#dark-logo {
    display: none;
}

body.dark-mode #light-logo {
    display: none;
}

body.dark-mode #dark-logo {
    display: inline-block;
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border-primary);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

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

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

.user-info a {
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.user-info a:hover {
    background: var(--color-bg-secondary);
    color: var(--color-error);
}

/* ========================================
   FORM SECTIONS
   ======================================== */

.form-section {
    margin-bottom: 30px;
}

.form-section h1 {
    color: var(--color-text-primary);
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 600;
}

.form-section h2 {
    color: var(--color-text-primary);
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: 600;
}

.form-section h3 {
    color: var(--color-text-secondary);
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 500;
}

.textSmaller {
    color: var(--color-text-tertiary);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-field {
    margin-bottom: 20px;
}

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

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

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(48, 120, 185, 0.2);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
    background: var(--color-input-disabled-bg);
    color: var(--color-input-disabled-text);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

button,
.primary-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

button:hover,
.primary-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--color-shadow-medium);
}

button:disabled,
.primary-btn:disabled {
    background: var(--color-text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

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

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

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

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

/* ========================================
   DASHBOARD STYLES
   ======================================== */

.dashboard-content {
    padding: 20px 0;
}

.welcome-message {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.welcome-message h2 {
    color: var(--color-primary);
    margin-bottom: 10px;
}

/* ========================================
   USER MANAGEMENT STYLES
   ======================================== */

.users-content {
    padding: 20px 0;
}

.users-actions {
    margin-bottom: 30px;
}

.user-form {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.user-form h3 {
    margin-bottom: 20px;
    color: var(--color-primary);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.users-list h3 {
    margin-bottom: 20px;
    color: var(--color-text-secondary);
}

.user-card {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--color-border-primary);
}

.user-info h4 {
    color: var(--color-text-primary);
    margin-bottom: 5px;
}

.user-info p {
    color: var(--color-text-tertiary);
    margin-bottom: 5px;
}

.user-roles {
    font-weight: 500;
    color: var(--color-primary);
}

.user-status {
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.user-status.active {
    background: var(--color-success);
    color: white;
}

.user-status.inactive {
    background: var(--color-error);
    color: white;
}

.user-actions {
    display: flex;
    gap: 10px;
}

/* ========================================
   AUDIT LOG STYLES
   ======================================== */

.audit-controls {
    margin-bottom: 20px;
}

.audit-filters {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.audit-filters .form-field {
    margin-bottom: 0;
    min-width: 150px;
}

.audit-filters select {
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--color-border-primary);
    border-radius: 6px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.audit-filters select:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-secondary);
}

.audit-filters select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.audit-log-container {
    background: var(--color-bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.audit-log-entry {
    padding: 15px;
    border-bottom: 1px solid var(--color-border-primary);
    display: grid;
    grid-template-columns: 150px 200px 150px 1fr 120px;
    gap: 15px;
    align-items: center;
}

.audit-log-entry:last-child {
    border-bottom: none;
}

.audit-log-entry.success {
    background: rgba(40, 167, 69, 0.1);
}

.audit-log-entry.failure {
    background: rgba(220, 53, 69, 0.1);
}

.log-timestamp {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.log-user {
    font-weight: 500;
    color: var(--color-text-secondary);
}

.log-action {
    font-weight: 500;
    color: var(--color-primary);
}

.log-details {
    color: var(--color-text-tertiary);
    font-size: 14px;
}

.log-ip {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ========================================
   PAGINATION STYLES
   ======================================== */

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: var(--color-bg-secondary);
    border-radius: 8px;
}

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

.pagination-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

/* ========================================
   ACCOUNT STYLES
   ======================================== */

.account-content {
    padding: 20px 0;
}

.account-details {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-tertiary);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    font-weight: 500;
    color: var(--color-text-secondary);
}

.detail-row span {
    color: var(--color-text-primary);
}

.token-display {
    font-family: monospace;
    font-size: 12px;
    background: var(--color-bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
}

.account-actions {
    text-align: center;
}

/* ========================================
   COMING SOON STYLES
   ======================================== */

.coming-soon-section {
    text-align: center;
    padding: 40px 0;
}

.coming-soon-content {
    max-width: 600px;
    margin: 0 auto;
}

.coming-soon-card {
    background: var(--color-bg-secondary);
    padding: 30px;
    border-radius: 12px;
    margin-top: 30px;
    text-align: left;
}

.features-preview {
    margin: 20px 0;
}

.features-preview h3 {
    color: var(--color-primary);
    margin-bottom: 15px;
}

.features-preview ul {
    list-style: none;
    padding: 0;
}

.features-preview li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: var(--color-text-secondary);
}

.features-preview li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

.contact-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border-primary);
}

.contact-info h3 {
    color: var(--color-primary);
    margin-bottom: 10px;
}

.contact-info a {
    color: var(--color-link-primary);
    text-decoration: none;
}

.contact-info a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

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

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

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

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

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

/* ========================================
   FOOTER STYLES
   ======================================== */

.footer-container {
    text-align: center;
    margin-top: 30px;
}

.primesites_footer {
    color: var(--color-text-tertiary);
    text-decoration: none;
    font-size: 12px;
    margin-top: 10px;
    display: inline-block;
    font-family: 'PrimeSites', 'Open Sans', sans-serif;
}

.primesites_footer:hover {
    color: var(--color-link-primary);
    text-decoration: underline;
}

#toggle-container {
    margin-top: 15px;
}

#toggle-container label {
    color: var(--color-text-tertiary);
    font-size: 12px;
    margin-right: 8px;
}

#toggle-container input[type="checkbox"] {
    width: auto;
    margin: 0;
}

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

@media (max-width: 768px) {
    .form-container {
        margin: 10px;
        padding: 15px;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .audit-log-entry {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .audit-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .audit-filters .form-field {
        min-width: auto;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .user-card {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .user-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .form-section h1 {
        font-size: 24px;
    }
    
    .form-section h2 {
        font-size: 20px;
    }
    
    .form-section h3 {
        font-size: 18px;
    }
    
    .coming-soon-card {
        padding: 20px;
    }
}

/* Audit Log Display Improvements */
.audit-log-entry {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audit-log-entry.success {
    border-left-color: #28a745;
}

.audit-log-entry.failure {
    border-left-color: #dc3545;
}

.log-header {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    width: 50%;
    display: inline-block;
}

.log-action {
    font-size: 13px;
    color: #6c757d;
    width: 50%;
    display: inline-block;
}

.log-details {
    font-size: 12px;
    color: #868e96;
    margin-bottom: 4px;
    font-style: italic;
}

.log-ip {
    font-size: 11px;
    color: #adb5bd;
}

/* Dark theme audit log styling */
body.dark-mode .audit-log-entry {
    border-left-color: #555;
}

body.dark-mode .audit-log-entry.success {
    border-left-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

body.dark-mode .audit-log-entry.failure {
    border-left-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

body.dark-mode .log-header {
    color: #e9ecef;
}

body.dark-mode .log-action {
    color: #adb5bd;
}

body.dark-mode .log-details {
    color: #6c757d;
}

body.dark-mode .log-ip {
    color: #495057;
}