/**
 * Unified Styles for ABS PDF Segmentation
 * Based on UI_UX_Color_System_Reference.html
 * Version: 1.0.0
 * 
 * This stylesheet provides consistent styling across all pages.
 * Import this file AFTER Tailwind CSS to apply unified customizations.
 */

/* ==================== Typography & Base Styles ==================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #F8F9FA;
    color: #242E42;
}

/* Import Inter font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==================== Loading Overlay ==================== */
.unified-loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
}

.unified-loading-overlay.hidden {
    display: none;
}

/* Spinner Animation */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-left-color: #ffffff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress Bar Container */
.progress-container {
    height: 10px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 1rem;
}

/* Progress Bar */
.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 5px;
    transition: width 0.3s ease-out;
}

/* ==================== Unified Inline Progress Bars ==================== */
.unified-progress-container { margin-bottom: 1rem; }
.unified-progress-text { color: #385072; font-size: 0.875rem; margin-bottom: 0.5rem; }
.unified-progress-bar-outer {
    width: 100%;
    height: 10px;
    background-color: #E5E7EB; /* gray-200 */
    border-radius: 5px;
    overflow: hidden;
}
.unified-progress-bar-inner {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
}
.unified-progress-brand { background-color: #007BFF; }

/* Striped animation for processing state */
.unified-progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
}
.unified-progress-bar-animated { animation: unified-progress-stripes 1s linear infinite; }
@keyframes unified-progress-stripes {
    from { background-position: 40px 0; }
    to { background-position: 0 0; }
}

/* ==================== Toast Notifications ==================== */
.unified-toast {
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease-in-out;
}

.unified-toast-success {
    background-color: #EAF7EC;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.unified-toast-error {
    background-color: #FBEAEB;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.unified-toast-warning {
    background-color: #FFF9E6;
    color: #7A5B00;
    border: 1px solid #FFEEBA;
}

.unified-toast-info {
    background-color: #EBF5FF;
    color: #0056B3;
    border: 1px solid #B3D4FF;
}

/* ==================== Alert Components ==================== */
.unified-alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid;
}

.unified-alert-success {
    background-color: #EAF7EC;
    color: #155724;
    border-color: #C3E6CB;
}

.unified-alert-error {
    background-color: #FBEAEB;
    color: #721C24;
    border-color: #F5C6CB;
}

.unified-alert-warning {
    background-color: #FFF9E6;
    color: #7A5B00;
    border-color: #FFEEBA;
}

.unified-alert-info {
    background-color: #EBF5FF;
    color: #0056B3;
    border-color: #B3D4FF;
}

/* ==================== Button Styles ==================== */
.btn-primary {
    background-color: #007BFF;
    color: #ffffff;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056B3;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: #A0CFFF;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-secondary {
    background-color: #E9ECEF;
    color: #385072;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid #B0BEC5;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #DEE2E6;
    border-color: #899AB8;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #28A745;
    color: #ffffff;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #D32F2F;
    color: #ffffff;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-danger:hover:not(:disabled) {
    background-color: #C62828;
    box-shadow: 0 4px 8px rgba(211, 47, 47, 0.3);
    transform: translateY(-1px);
}

.btn-warning {
    background-color: #FBC02D;
    color: #242E42;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-warning:hover:not(:disabled) {
    background-color: #F9A825;
    box-shadow: 0 4px 8px rgba(251, 192, 45, 0.3);
    transform: translateY(-1px);
}

/* ==================== Form Elements ==================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
textarea,
select {
    border: 1px solid #E9ECEF;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: #242E42;
    background-color: #ffffff;
    transition: all 0.2s ease-in-out;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
    color: #899AB8;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #385072;
    display: block;
    margin-bottom: 0.375rem;
}

/* File Input Styling */
input[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    background-color: #EBF5FF;
    color: #007BFF;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

input[type="file"]::file-selector-button:hover {
    background-color: #D1E7FF;
}

/* ==================== Card Styles ==================== */
.card {
    background-color: #ffffff;
    border: 1px solid #E9ECEF;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
    font-size: 1.125rem;
    font-weight: 600;
    color: #242E42;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #E9ECEF;
}

/* ==================== Status Badges ==================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-success {
    background-color: #EAF7EC;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.badge-error,
.badge-danger {
    background-color: #FBEAEB;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.badge-warning {
    background-color: #FFF9E6;
    color: #7A5B00;
    border: 1px solid #FFEEBA;
}

.badge-info {
    background-color: #EBF5FF;
    color: #0056B3;
    border: 1px solid #B3D4FF;
}

.badge-pass {
    background-color: #EAF7EC;
    color: #0B2A13;
    border: 1px solid #C3E6CB;
}

.badge-not-pass,
.badge-fail {
    background-color: #FBEAEB;
    color: #4A1217;
    border: 1px solid #F5C6CB;
}

/* ==================== Table Styles ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background-color: #F8F9FA;
    border-bottom: 2px solid #E9ECEF;
}

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #242E42;
    font-size: 0.875rem;
}

tbody tr {
    border-bottom: 1px solid #E9ECEF;
    transition: background-color 0.15s ease-in-out;
}

tbody tr:hover {
    background-color: #F8F9FA;
}

tbody td {
    padding: 0.875rem 1rem;
    color: #385072;
}

/* ==================== Divider ==================== */
hr {
    border: none;
    border-top: 1px solid #B0BEC5;
    margin: 1.5rem 0;
}

/* ==================== Link Styles ==================== */
a {
    color: #007BFF;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: #0056B3;
    text-decoration: underline;
}

/* ==================== Scrollbar Styles (for Webkit browsers) ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F8F9FA;
}

::-webkit-scrollbar-thumb {
    background: #B0BEC5;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #899AB8;
}

/* ==================== Utility Classes ==================== */
.text-primary {
    color: #242E42 !important;
}

.text-secondary {
    color: #385072 !important;
}

.text-tertiary {
    color: #899AB8 !important;
}

.bg-page {
    background-color: #F8F9FA !important;
}

.bg-card {
    background-color: #ffffff !important;
}

.border-default {
    border-color: #E9ECEF !important;
}

.divider-color {
    border-color: #B0BEC5 !important;
}

/* ==================== Animation Classes ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-in-out;
}

.animate-slide-down {
    animation: slideDown 0.3s ease-in-out;
}

/* ==================== Responsive Utilities ==================== */
@media (max-width: 640px) {
    .card {
        padding: 1rem;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-warning {
        font-size: 0.8125rem;
        padding: 0.5rem 1rem;
    }
    
    thead th,
    tbody td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}
