/* Base Styles for Sunrise ERP - Global Styling */

/* CSS Variables - Consistent Theme */
:root {
  --primary: #FF6B35;         /* Sunrise Orange */
  --accent: #F7931E;          /* Warm Orange */
  --font-primary: 'Poppins', sans-serif;
  --font-secondary: 'Montserrat', sans-serif;
  --text-dark: #1F2937;
  --text-medium: #6B7280;
  --text-light: #9CA3AF;
  --bg-light: #F9FAFB;
  --bg-white: #FFFFFF;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 1rem;
  --transition-normal: 0.3s ease;
  --gradient-primary: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.5;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-dark);
  background: linear-gradient(to bottom right, #f8f9fa, #e9ecef);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-medium);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-normal);
}

a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Layout Utilities */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-fluid {
  width: 100%;
  padding: 0 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: -0.5rem;
}

.col {
  flex: 1;
  padding: 0.5rem;
}

/* Grid System */
.col-1 { width: 8.333333%; }
.col-2 { width: 16.666667%; }
.col-3 { width: 25%; }
.col-4 { width: 33.333333%; }
.col-5 { width: 41.666667%; }
.col-6 { width: 50%; }
.col-7 { width: 58.333333%; }
.col-8 { width: 66.666667%; }
.col-9 { width: 75%; }
.col-10 { width: 83.333333%; }
.col-11 { width: 91.666667%; }
.col-12 { width: 100%; }

/* Responsive Grid */
@media (max-width: 768px) {
  .col-md-1, .col-md-2, .col-md-3, .col-md-4,
  .col-md-5, .col-md-6, .col-md-7, .col-md-8,
  .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
    width: 100%;
  }
}

/* Button Overrides for Bootstrap Compatibility */
.btn-primary {
  background: var(--gradient-primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md) !important;
}

/* Form Overrides */
.form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25) !important;
}

/* Navigation Overrides */
.navbar-brand {
  font-family: var(--font-secondary) !important;
  font-weight: 700 !important;
  color: var(--primary) !important;
}

/* Card Overrides */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

.card-header {
  background: var(--bg-light) !important;
  border-bottom: 1px solid var(--border) !important;
  font-weight: 600 !important;
}

/* Alert Overrides */
.alert-primary {
  background: rgba(255, 107, 53, 0.1) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: var(--warning) !important;
  color: var(--warning) !important;
}

/* Table Styling */
.table {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th {
  background: var(--bg-light);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-dark);
}

.table td {
  border-bottom: 1px solid var(--border);
  color: var(--text-medium);
}

.table-hover tbody tr:hover {
  background: rgba(255, 107, 53, 0.05);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 53, 0.3);
  border-radius: var(--radius-sm);
  transition: background var(--transition-normal);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 53, 0.5);
}

/* Focus Styles */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection Styles */
::selection {
  background: rgba(255, 107, 53, 0.2);
  color: var(--text-dark);
}

::-moz-selection {
  background: rgba(255, 107, 53, 0.2);
  color: var(--text-dark);
}

/* Smooth Transitions */
* {
  transition: color var(--transition-normal),
              background-color var(--transition-normal),
              border-color var(--transition-normal),
              transform var(--transition-normal),
              box-shadow var(--transition-normal);
}

/* Print Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .sidebar,
  .top-header,
  .btn,
  button {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border: #000000;
    --text-medium: #000000;
    --bg-light: #FFFFFF;
  }
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b3d7ff;
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
    color: #6c757d;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    background: #007bff;
    color: #fff;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    text-align: right;
    border-top: 1px solid #ddd;
}

.close {
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close:hover {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .col-6, .col-4, .col-3 {
        width: 100%;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .login-card {
        margin: 20px;
        padding: 30px;
    }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}