/* Custom styles for the Vigenère Cipher Web Interface */

/* Beautiful gradient background */
.bg-gradient {
    background: linear-gradient(135deg, 
        #667eea 0%, 
        #764ba2 25%, 
        #f093fb 50%, 
        #f5576c 75%, 
        #4facfe 100%);
    background-size: 300% 300%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Card enhancements */
.card {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Tab styling */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.5rem 0.5rem 0;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 0.5rem 0.5rem 0 0;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    margin-right: 0.25rem;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.nav-tabs .nav-link.active:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    color: white;
}

/* Tab content styling */
.tab-content {
    background: transparent;
}

.tab-pane {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-header {
    background: linear-gradient(45deg, #007bff, #0056b3) !important;
}

/* Form controls styling */
.form-control {
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(-2px);
}

/* Button enhancements */
.btn {
    transition: all 0.3s ease;
}

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

.btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

/* Action button styling */
.btn-check:checked + .btn-outline-success {
    background: linear-gradient(45deg, #28a745, #1e7e34);
    border-color: #28a745;
}

.btn-check:checked + .btn-outline-warning {
    background: linear-gradient(45deg, #ffc107, #e0a800);
    border-color: #ffc107;
    color: #212529;
}

/* Result section styling */
.alert-success {
    border-left: 5px solid #28a745;
    background: rgba(40, 167, 69, 0.1);
}

#result {
    background: linear-gradient(45deg, #007bff, #0056b3) !important;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    word-break: break-all;
}

/* Character counter */
#charCount {
    font-weight: bold;
    color: #007bff;
}

/* Loading animation */
.btn.loading {
    pointer-events: none;
}

.btn.loading .fas {
    animation: spin 1s linear infinite;
}

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

/* Responsive improvements */
@media (max-width: 768px) {
    .card-body {
        padding: 2rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 2rem !important;
    }
}

/* Form labels styling */
.form-label {
    color: #495057;
    font-size: 1.1rem;
}

/* Success animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Copy button hover effect */
.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Input validation styling */
.form-control.is-invalid {
    border-color: #dc3545;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-control.is-valid {
    border-color: #28a745;
}

/* Toast styling for notifications */
.toast {
    border: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   INDIVIDUAL TEST SECTION STYLING
   ============================================================================ */

/* Individual test section styling */
#test .card-header {
    background: linear-gradient(45deg, #ffc107, #e0a800) !important;
    color: #212529 !important;
}

/* Individual test form styling */
#test .form-control {
    border: 1px solid #ced4da;
    border-radius: 6px;
}

#test .form-control:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* Individual test button styling */
#runIndividualTestBtn {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#runIndividualTestBtn:hover {
    background: linear-gradient(45deg, #218838, #1ea080);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
}

#runIndividualTestBtn:disabled {
    background: #6c757d;
    box-shadow: none;
    transform: none;
}

/* Individual test results styling */
#individualTestResults .alert {
    border-left: 5px solid #28a745;
    background: rgba(40, 167, 69, 0.1);
}

#encryptedTestResult {
    background: linear-gradient(45deg, #007bff, #0056b3) !important;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    word-break: break-all;
}

#decryptedTestResult {
    background: linear-gradient(45deg, #28a745, #1e7e34) !important;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    word-break: break-all;
}

/* Test character counter */
#testCharCount {
    font-weight: bold;
    color: #ffc107;
}

/* ============================================================================
   CIPHER COMPARISON SECTION STYLING
   ============================================================================ */

/* Comparison section styling */
#comparisonSection {
    margin-top: 0;
    justify-content: center;
}

#comparisonSection .card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    max-width: 100%;
}

#comparisonSection .card-header {
    background: linear-gradient(45deg, #17a2b8, #138496) !important;
    text-align: center;
}

/* Center form controls and buttons */
.text-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.text-center .btn {
    margin: 0.25rem;
}

/* Performance chart styling */
#performanceChart {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Results table styling */
.table-responsive {
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
    min-width: 500px; /* Ensure minimum width for all columns */
}

.table thead th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    text-align: center;
    white-space: nowrap;
    padding: 0.75rem 0.5rem;
}

.table tbody td {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    padding: 0.75rem 0.5rem;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: scale(1.002);
    transition: all 0.2s ease;
}

/* Performance indicators */
.table-success {
    background-color: rgba(40, 167, 69, 0.1) !important;
    position: relative;
}

.table-success::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #28a745;
}

/* Badge styling for comparison */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Trophy icon animation */
.fa-trophy {
    animation: trophy-glow 2s ease-in-out infinite;
}

@keyframes trophy-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Test configuration inputs */
#comparisonSection .form-control {
    border: 1px solid #ced4da;
    border-radius: 6px;
}

#comparisonSection .form-control:focus {
    border-color: #17a2b8;
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.25);
}

/* Form row centering */
#comparisonSection .row {
    justify-content: center;
    align-items: end;
}

/* Results section centering */
#comparisonResults {
    justify-content: center;
    align-items: flex-start;
}

#comparisonResults .col-xl-7,
#comparisonResults .col-xl-5,
#comparisonResults .col-lg-6,
#comparisonResults .col-12 {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#comparisonResults h6 {
    text-align: center;
    width: 100%;
}

/* Side-by-side layout optimizations */
@media (min-width: 992px) {
    #comparisonResults .col-lg-6 {
        margin-bottom: 0;
    }
    
    .chart-container {
        min-height: 300px;
        justify-content: center;
    }
    
    #performanceChart {
        max-width: 100%;
        height: auto;
    }
}

@media (min-width: 1200px) {
    #comparisonResults .col-xl-7 {
        margin-bottom: 0;
    }
    
    .chart-container {
        min-height: 350px;
    }
    
    #performanceChart {
        width: 400px;
        height: 250px;
    }
}

/* Button styling for comparison section */
#runTestBtn {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#runTestBtn:hover {
    background: linear-gradient(45deg, #218838, #1ea080);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
}

#runTestBtn:disabled {
    background: #6c757d;
    box-shadow: none;
    transform: none;
}

/* Toggle button styling */
#toggleComparison {
    transition: all 0.3s ease;
    border-width: 2px;
}

#toggleComparison:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Random data generator button */
.btn-info {
    background: linear-gradient(45deg, #17a2b8, #138496);
    border: none;
}

.btn-info:hover {
    background: linear-gradient(45deg, #138496, #117a8b);
    transform: translateY(-1px);
}

/* Comparison results animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#comparisonResults {
    animation: slideInUp 0.6s ease-out;
}

/* Performance metrics styling */
.performance-metric {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.performance-metric.fastest {
    background: rgba(40, 167, 69, 0.15);
    color: #155724;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.performance-metric.slowest {
    background: rgba(220, 53, 69, 0.15);
    color: #721c24;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* Chart container styling */
.chart-container {
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

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

/* Responsive adjustments for all sections */
@media (max-width: 768px) {
    .bg-gradient {
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem;
    }
    
    /* Tab navigation improvements */
    .nav-tabs .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Form improvements */
    .form-label {
        font-size: 1rem;
    }
    
    /* Button group improvements */
    .btn-group .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Individual test section */
    #test .col-lg-6,
    #test .col-lg-3 {
        margin-bottom: 1rem;
    }
    
    #runIndividualTestBtn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Comparison section */
    #comparisonSection .col-md-5,
    #comparisonSection .col-md-3,
    #comparisonSection .col-md-2 {
        margin-bottom: 0.75rem;
    }
    
    #comparisonResults .col-xl-7,
    #comparisonResults .col-xl-5,
    #comparisonResults .col-lg-6,
    #comparisonResults .col-12 {
        margin-bottom: 1rem;
    }
    
    #performanceChart {
        height: 280px;
        width: 100%;
    }
    
    .table-responsive {
        font-size: 0.8rem;
        margin-bottom: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
        font-size: 0.8rem;
    }
    
    .table-sm td, .table-sm th {
        padding: 0.5rem 0.25rem;
        text-align: center;
        white-space: nowrap;
    }
    
    #runTestBtn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Hide algorithm descriptions on smaller screens */
    .table-responsive .text-muted {
        display: none;
    }
    
    .chart-container {
        min-height: 300px;
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    .bg-gradient {
        padding: 0.25rem;
        padding-top: 1rem;
    }
    
    .card {
        max-width: 100% !important;
        margin: 0;
        border-radius: 0.5rem !important;
    }
    
    .card-header {
        padding: 1rem !important;
    }
    
    .card-header h1 {
        font-size: 1.25rem !important;
    }
    
    /* Tab navigation for mobile */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        min-width: auto;
        flex-shrink: 0;
    }
    
    /* Form improvements for mobile */
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }
    
    /* Individual test improvements */
    #test .row.g-3 {
        margin: 0;
    }
    
    #test .col-lg-6,
    #test .col-lg-3 {
        padding: 0.5rem;
    }
    
    /* Table improvements for mobile */
    .table-responsive {
        font-size: 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }
    
    .table {
        min-width: 550px;
        font-size: 0.75rem;
    }
    
    .table-sm td, .table-sm th {
        padding: 0.4rem 0.2rem;
        text-align: center;
        white-space: nowrap;
        font-size: 0.7rem;
    }
    
    .badge.small {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.4rem;
    }
    
    .btn-sm {
        padding: 0.125rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .form-control-sm {
        font-size: 0.8rem;
    }
    
    .chart-container {
        min-height: 260px;
        padding: 0.25rem;
    }
    
    #performanceChart {
        height: 240px;
    }
    
    /* Ensure table content doesn't wrap */
    .table-responsive .table td,
    .table-responsive .table th {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    /* Result sections for mobile */
    .alert .row.g-3 {
        margin: 0;
    }
    
    .alert .col-md-6,
    .alert .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* Loading spinner for test execution */
.fa-spinner {
    animation: spin 1s linear infinite !important;
}

/* Security level indicators */
.security-indicator {
    position: relative;
    overflow: hidden;
}

.security-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.security-indicator:hover::before {
    left: 100%;
}

/* Additional responsive improvements */
@media (max-width: 480px) {
    .card-header h1 {
        font-size: 1.1rem !important;
    }
    
    .card-header p {
        font-size: 0.8rem !important;
    }
    
    .nav-tabs .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    .alert-heading {
        font-size: 1.1rem;
    }
    
    .alert .row.g-3 .col-12 {
        padding: 0.25rem;
    }
}

/* High DPI display improvements */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card {
        border-width: 0.5px;
    }
    
    .form-control {
        border-width: 1px;
    }
    
    .btn {
        border-width: 1px;
    }
} 