/**
 * Main CSS File
 * Import theme.css.php for dynamic theme variables
 */

/* Inter Font Family */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter/Inter_18pt-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter/Inter_18pt-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter/Inter_18pt-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter/Inter_18pt-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Only hide overflow on dashboard pages */
body.dashboard-page {
    overflow: hidden;
    height: 100%;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
}

.btn i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-primary {
    background: var(--button-primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--button-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 108, 247, 0.4);
}

.btn-secondary {
    background: var(--button-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--button-secondary-hover);
}

.btn-danger {
    background: var(--button-danger);
    color: var(--text-primary);
}

.btn-danger:hover {
    background: var(--button-danger-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition);
}

.card:hover {
    background: var(--card-hover);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(74, 108, 247, 0.15);
}

/* Inputs */
.input-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--font-size-small);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="date"],
textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    color: var(--input-text);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    transition: all var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Date input styling */
input[type="date"] {
    padding-right: 40px;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A6CF7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-size: 18px;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    opacity: 1;
    width: 30px;
    height: 30px;
    margin-right: var(--spacing-xs);
    padding: 0;
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(218deg) brightness(98%) contrast(97%);
    transition: filter var(--transition);
}

input[type="date"]:hover::-webkit-calendar-picker-indicator {
    filter: brightness(0) saturate(100%) invert(42%) sepia(79%) saturate(2476%) hue-rotate(218deg) brightness(90%) contrast(97%);
}

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
    display: none;
}

input[type="date"]::-webkit-datetime-edit-text {
    color: var(--text-primary);
    padding: 0 2px;
    font-weight: 500;
}

input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    color: var(--text-primary);
    padding: 0 2px;
    font-weight: 500;
}

input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
    background-color: var(--accent);
    color: white;
    border-radius: 3px;
    padding: 2px 4px;
}

select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-right: 35px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    color: var(--input-text);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    transition: all var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-sm) center;
    background-size: 12px;
}

select {
    cursor: pointer;
}

select:hover {
    border-color: var(--input-border-focus);
    background-color: var(--bg-tertiary);
}

select:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: none;
}

select:active {
    box-shadow: none;
}

select::-ms-expand {
    display: none;
}

select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--spacing-sm);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input::placeholder,
textarea::placeholder {
    color: var(--input-placeholder);
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--spacing-sm);
    cursor: pointer;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Flash Messages */
.flash-message {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 1000;
    animation: slideInRightBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRightBounce {
    0% {
        transform: translateX(120%);
        opacity: 0;
    }
    60% {
        transform: translateX(-10px);
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-message.success {
    border-left: 4px solid var(--success);
}

.flash-message.error {
    border-left: 4px solid var(--error);
}

.flash-message.warning {
    border-left: 4px solid var(--warning);
}

.flash-message.info {
    border-left: 4px solid var(--info);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Fixed Footer for non-dashboard pages */
body:not(.dashboard-page) {
    padding-bottom: 50px; /* Space for fixed footer */
}

body:not(.dashboard-page) .site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-xs) var(--spacing-md);
    min-height: 40px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* Dashboard pages keep normal footer behavior */
body.dashboard-page .site-footer {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    
    body:not(.dashboard-page) {
        padding-bottom: 45px; /* Slightly less space on mobile */
    }
    
    body:not(.dashboard-page) .site-footer {
        min-height: 35px;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}
