/*
 * Octacer Ultra-Dark Theme Component Library
 * Version: 1.0.0
 *
 * Color Palette:
 * - Primary Dark: #040408
 * - Panel Background: #0A0F1A
 * - Border: #1F2937
 * - Primary Green: #A3DC2F
 * - Muted Text: #9CA3AF
 *
 * Components:
 * - Buttons (primary, secondary, danger, ghost, icon)
 * - Form Inputs (text, select, textarea, checkbox, radio)
 * - Cards (dark panels with variants)
 * - Badges (status indicators)
 * - Tables (dark tables with hover effects)
 */

/* ============================================
   BUTTON STYLES
   ============================================ */

/* Base Button Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button - Green with Glow */
.btn-primary {
    background: linear-gradient(135deg, #A3DC2F 0%, #8BC225 100%);
    color: #040408;
    border: none;
    box-shadow: 0 0 20px rgba(163, 220, 47, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #B8E84A 0%, #A3DC2F 100%);
    box-shadow: 0 0 30px rgba(163, 220, 47, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 0 15px rgba(163, 220, 47, 0.4);
}

/* Secondary Button - Outline Style */
.btn-secondary {
    background: transparent;
    color: #A3DC2F;
    border: 2px solid #A3DC2F;
    box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(163, 220, 47, 0.1);
    border-color: #B8E84A;
    color: #B8E84A;
}

.btn-secondary:active:not(:disabled) {
    background: rgba(163, 220, 47, 0.15);
}

/* Danger Button - Red for Destructive Actions */
.btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #FFFFFF;
    border: none;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #F87171 0%, #EF4444 100%);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-danger:active:not(:disabled) {
    transform: translateY(0);
}

/* Ghost Button - Transparent */
.btn-ghost {
    background: transparent;
    color: #9CA3AF;
    border: 1px solid transparent;
    box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(31, 41, 55, 0.5);
    color: #FFFFFF;
    border-color: #1F2937;
}

.btn-ghost:active:not(:disabled) {
    background: rgba(31, 41, 55, 0.7);
}

/* Icon Button - Minimal Style */
.btn-icon {
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    background: #0A0F1A;
    color: #9CA3AF;
    border: 1px solid #1F2937;
    border-radius: 0.5rem;
}

.btn-icon:hover:not(:disabled) {
    background: #1F2937;
    color: #A3DC2F;
    border-color: #A3DC2F;
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon-sm {
    width: 2rem;
    height: 2rem;
    padding: 0.375rem;
}

.btn-icon-lg {
    width: 3rem;
    height: 3rem;
    padding: 0.625rem;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

.btn-group-attached {
    display: inline-flex;
}

.btn-group-attached .btn {
    border-radius: 0;
}

.btn-group-attached .btn:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.btn-group-attached .btn:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* ============================================
   FORM INPUT STYLES
   ============================================ */

/* Base Input Style */
.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #FFFFFF;
    background-color: #0A0F1A;
    border: 1px solid #1F2937;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #9CA3AF;
}

/* Focus State - Green Glow */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #A3DC2F;
    box-shadow: 0 0 0 3px rgba(163, 220, 47, 0.1),
                0 0 15px rgba(163, 220, 47, 0.2);
}

/* Hover State */
.form-input:hover:not(:disabled),
.form-select:hover:not(:disabled),
.form-textarea:hover:not(:disabled) {
    border-color: #374151;
}

/* Disabled State */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #050810;
}

/* Form Textarea */
.form-textarea {
    min-height: 6rem;
    resize: vertical;
}

/* Form Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239CA3AF' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Validation States */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: #EF4444;
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1),
                0 0 15px rgba(239, 68, 68, 0.2);
}

.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
    border-color: #10B981;
}

.form-input.is-valid:focus,
.form-select.is-valid:focus,
.form-textarea.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1),
                0 0 15px rgba(16, 185, 129, 0.2);
}

/* Form Label */
.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #D1D5DB;
}

.form-label.required::after {
    content: '*';
    color: #EF4444;
    margin-left: 0.25rem;
}

/* Form Group */
.form-group {
    margin-bottom: 1.25rem;
}

/* Form Feedback */
.form-feedback {
    margin-top: 0.375rem;
    font-size: 0.75rem;
}

.form-feedback.is-invalid {
    color: #EF4444;
}

.form-feedback.is-valid {
    color: #10B981;
}

/* Checkbox and Radio Styles */
.form-checkbox,
.form-radio {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #1F2937;
    background-color: #0A0F1A;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-checkbox {
    border-radius: 0.25rem;
}

.form-radio {
    border-radius: 50%;
}

.form-checkbox:checked,
.form-radio:checked {
    background-color: #A3DC2F;
    border-color: #A3DC2F;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23040408'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.form-radio:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle r='3' fill='%23040408' cx='8' cy='8'/%3E%3C/svg%3E");
}

.form-checkbox:focus,
.form-radio:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(163, 220, 47, 0.1);
}

/* Form Check Container */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.form-check-label {
    color: #D1D5DB;
    font-size: 0.875rem;
    cursor: pointer;
}

/* ============================================
   CARD STYLES
   ============================================ */

/* Base Card Style */
.card-dark {
    background-color: #0A0F1A;
    border: 1px solid #1F2937;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card-dark:hover {
    border-color: rgba(163, 220, 47, 0.3);
    box-shadow: 0 0 20px rgba(163, 220, 47, 0.1);
}

/* Card Header */
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #1F2937;
}

.card-header h3,
.card-header h4 {
    margin: 0;
    color: #FFFFFF;
    font-weight: 600;
}

/* Card Body */
.card-body {
    padding: 1.5rem;
}

/* Card Footer */
.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #1F2937;
    background-color: rgba(4, 4, 8, 0.3);
}

/* Card Variants */
.card-highlight {
    border: 2px solid #A3DC2F;
    box-shadow: 0 0 25px rgba(163, 220, 47, 0.15);
}

.card-compact .card-body {
    padding: 1rem;
}

.card-spacious .card-body {
    padding: 2rem;
}

/* ============================================
   BADGE STYLES
   ============================================ */

/* Base Badge Style */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Status Badge Variants */
.badge-active {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pending {
    background-color: rgba(251, 191, 36, 0.15);
    color: #FBB028;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-rejected {
    background-color: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-draft {
    background-color: rgba(156, 163, 175, 0.15);
    color: #9CA3AF;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.badge-closed {
    background-color: rgba(107, 114, 128, 0.15);
    color: #6B7280;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Badge with Dot Indicator */
.badge-dot::before {
    content: '';
    display: inline-block;
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    margin-right: 0.375rem;
    background-color: currentColor;
}

/* Badge Sizes */
.badge-sm {
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
}

.badge-lg {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
}

/* Outline Badge Variants */
.badge-outline {
    background-color: transparent;
    border: 1.5px solid currentColor;
}

/* ============================================
   TABLE STYLES
   ============================================ */

/* Table Container */
.table-container {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid #1F2937;
    background-color: #0A0F1A;
}

/* Base Table Style */
.table-dark {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

/* Table Header */
.table-dark thead {
    background-color: #040408;
    border-bottom: 2px solid #1F2937;
}

.table-dark thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #A3DC2F;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Table Body */
.table-dark tbody tr {
    border-bottom: 1px solid #1F2937;
    transition: all 0.2s ease;
}

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

/* Table Row Hover - Green Glow */
.table-dark tbody tr:hover {
    background-color: rgba(163, 220, 47, 0.05);
    box-shadow: inset 0 0 0 1px rgba(163, 220, 47, 0.1);
}

/* Table Cells */
.table-dark td {
    padding: 1rem;
    color: #D1D5DB;
}

.table-dark td:first-child {
    color: #FFFFFF;
    font-weight: 500;
}

/* Striped Table */
.table-dark.table-striped tbody tr:nth-child(even) {
    background-color: rgba(31, 41, 55, 0.3);
}

/* Compact Table */
.table-dark.table-compact td,
.table-dark.table-compact th {
    padding: 0.625rem 0.875rem;
}

/* Table Cell Alignments */
.table-dark .text-right {
    text-align: right;
}

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

/* ============================================
   RESPONSIVE MEDIA QUERIES
   ============================================ */

/* Mobile-First Approach: Default styles above are mobile-friendly */

/* ============================================
   MOBILE DEVICES (max-width: 639px)
   ============================================ */
@media (max-width: 639px) {
    /* Button Adjustments - Smaller padding for mobile */
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .btn-sm {
        padding: 0.375rem 0.625rem;
        font-size: 0.6875rem;
    }

    .btn-lg {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .btn-icon {
        width: 2.25rem;
        height: 2.25rem;
        padding: 0.375rem;
    }

    .btn-icon-lg {
        width: 2.75rem;
        height: 2.75rem;
        padding: 0.5rem;
    }

    /* Card Adjustments - Tighter padding */
    .card-dark {
        border-radius: 0.5rem;
    }

    .card-header {
        padding: 1rem 1.25rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-footer {
        padding: 0.875rem 1.25rem;
    }

    .card-compact .card-body {
        padding: 0.75rem;
    }

    .card-spacious .card-body {
        padding: 1.25rem;
    }

    /* Badge Adjustments - Smaller text */
    .badge {
        padding: 0.1875rem 0.625rem;
        font-size: 0.6875rem;
    }

    .badge-sm {
        padding: 0.125rem 0.375rem;
        font-size: 0.5625rem;
    }

    .badge-lg {
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Form Input Adjustments - Reduce padding */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.25rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-feedback {
        font-size: 0.6875rem;
    }

    /* Form Checkbox/Radio - Smaller size */
    .form-checkbox,
    .form-radio {
        width: 1.125rem;
        height: 1.125rem;
    }

    /* Table Adjustments */
    .table-container {
        border-radius: 0.5rem;
    }

    .table-dark {
        font-size: 0.75rem;
    }

    .table-dark thead th {
        padding: 0.75rem 0.625rem;
        font-size: 0.6875rem;
    }

    .table-dark td {
        padding: 0.75rem 0.625rem;
    }

    .table-dark.table-compact td,
    .table-dark.table-compact th {
        padding: 0.5rem 0.5rem;
    }

    /* Utility Adjustments */
    .divider-dark {
        margin: 1rem 0;
    }

    /* Touch-friendly minimum heights */
    .btn,
    .form-input,
    .form-select {
        min-height: 44px;
    }
}

/* ============================================
   TABLET DEVICES (640px to 1023px)
   ============================================ */
@media (min-width: 640px) and (max-width: 1023px) {
    /* Button Adjustments - Medium sizing */
    .btn {
        padding: 0.5625rem 1.125rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .btn-lg {
        padding: 0.8125rem 1.5rem;
        font-size: 0.9375rem;
    }

    .btn-icon {
        width: 2.375rem;
        height: 2.375rem;
        padding: 0.4375rem;
    }

    /* Card Adjustments - Medium padding */
    .card-header {
        padding: 1.125rem 1.375rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .card-footer {
        padding: 0.9375rem 1.375rem;
    }

    .card-compact .card-body {
        padding: 0.875rem;
    }

    .card-spacious .card-body {
        padding: 1.625rem;
    }

    /* Table Adjustments */
    .table-dark {
        font-size: 0.8125rem;
    }

    .table-dark thead th {
        padding: 0.8125rem 0.875rem;
    }

    .table-dark td {
        padding: 0.875rem 0.875rem;
    }

    /* Touch-friendly tap targets */
    .btn,
    .form-input,
    .form-select,
    .btn-icon {
        min-height: 44px;
    }
}

/* ============================================
   DESKTOP DEVICES (min-width: 1024px)
   ============================================ */
@media (min-width: 1024px) {
    /* Full padding restored - default styles apply */
    /* Enhanced hover effects for desktop */

    .btn:hover:not(:disabled) {
        cursor: pointer;
    }

    .card-dark:hover {
        transform: translateY(-2px);
    }

    /* Larger touch targets for precision pointing devices */
    .btn-icon:hover:not(:disabled) {
        transform: scale(1.05);
    }

    /* Enhanced table hover on desktop */
    .table-dark tbody tr:hover {
        transform: translateX(2px);
    }

    /* Smoother scrollbars on desktop */
    ::-webkit-scrollbar {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   LARGE DESKTOP (min-width: 1280px)
   ============================================ */
@media (min-width: 1280px) {
    /* Increased spacing for large screens */
    .card-body {
        padding: 1.75rem;
    }

    .card-spacious .card-body {
        padding: 2.25rem;
    }

    .form-group {
        margin-bottom: 1.5rem;
    }

    /* Larger table cells for readability */
    .table-dark td,
    .table-dark th {
        padding: 1.125rem 1.25rem;
    }
}

/* ============================================
   EXTRA LARGE DESKTOP (min-width: 1536px)
   ============================================ */
@media (min-width: 1536px) {
    /* Maximum comfortable reading width adjustments */
    .card-body {
        padding: 2rem;
    }

    .card-spacious .card-body {
        padding: 2.5rem;
    }

    /* Optimal table spacing */
    .table-dark td,
    .table-dark th {
        padding: 1.25rem 1.5rem;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Touch-specific adjustments for all interactive elements */

    .btn,
    .form-input,
    .form-select,
    .form-checkbox,
    .form-radio {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger tap targets for icon buttons */
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }

    .btn-icon-sm {
        min-width: 40px;
        min-height: 40px;
    }

    /* Increased padding for better touch targets */
    .btn {
        padding: 0.75rem 1.25rem;
    }

    /* Remove hover effects on touch devices */
    .btn:hover:not(:disabled),
    .card-dark:hover,
    .form-input:hover:not(:disabled) {
        transform: none;
    }

    /* Enhanced focus for touch */
    .btn:focus,
    .form-input:focus,
    .form-select:focus {
        box-shadow: 0 0 0 4px rgba(163, 220, 47, 0.2);
    }

    /* Larger checkboxes and radios */
    .form-checkbox,
    .form-radio {
        width: 1.5rem;
        height: 1.5rem;
    }

    /* Prevent accidental zooming */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px;
    }
}

/* ============================================
   HIGH RESOLUTION DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .card-dark,
    .form-input,
    .form-select,
    .btn {
        border-width: 0.5px;
    }

    /* Enhanced glow effects */
    .btn-primary {
        box-shadow: 0 0 25px rgba(163, 220, 47, 0.35);
    }

    .glow-green {
        box-shadow: 0 0 25px rgba(163, 220, 47, 0.35);
    }

    .glow-green-strong {
        box-shadow: 0 0 35px rgba(163, 220, 47, 0.55);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    /* Optimize for printing */
    .btn,
    .card-dark,
    .form-input,
    .table-dark {
        border-color: #000;
        background-color: #fff;
        color: #000;
        box-shadow: none;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        background: #fff;
        color: #000;
        border: 1px solid #000;
    }

    /* Hide interactive elements */
    .btn-icon,
    .btn-ghost {
        display: none;
    }

    /* Simplify badges */
    .badge {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
}

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

/* Shadows */
.shadow-octacer {
    box-shadow: 0 10px 30px rgba(163, 220, 47, 0.1);
}

.shadow-octacer-lg {
    box-shadow: 0 20px 50px rgba(163, 220, 47, 0.15);
}

/* Glow Effect */
.glow-green {
    box-shadow: 0 0 20px rgba(163, 220, 47, 0.3);
}

.glow-green-strong {
    box-shadow: 0 0 30px rgba(163, 220, 47, 0.5);
}

/* Dividers */
.divider-dark {
    height: 1px;
    background-color: #1F2937;
    margin: 1.5rem 0;
}

/* Transitions */
.transition-octacer {
    transition: all 0.3s ease;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid #A3DC2F;
    outline-offset: 2px;
}

/* Scrollbar Styling (Webkit) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #0A0F1A;
}

::-webkit-scrollbar-thumb {
    background: #1F2937;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #1F2937 #0A0F1A;
}
