/* Custom Styles for Encode/Decode Tool */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --secondary-color: #6c757d;
    --bg-color: #f8f9fa;
    --card-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    /* Mobile viewport fix */
    height: 100vh;
    height: -webkit-fill-available;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Remove default padding/margins for mobile */
@media (max-width: 576px) {
    * {
        box-sizing: border-box;
    }
}

.card {
    border-radius: 1rem;
    overflow: hidden;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.main-card {
    max-height: calc(100vh - 180px);
}

.card-body {
    background-color: #ffffff;
    overflow-y: auto;
    flex: 1;
}

.card-body-scrollable {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Mobile specific adjustments */
@media (max-width: 576px) {
    .main-card {
        max-height: calc(100vh - 120px);
    }
    
    .card-body-scrollable {
        max-height: calc(100vh - 140px);
    }
}

/* Nav Pills Styling */
.nav-pills .nav-link {
    color: var(--secondary-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.nav-pills .nav-link:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.nav-pills .nav-link.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* Form Controls */
.form-control {
    border-radius: 0.5rem;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    color: #495057;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.3);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(13, 110, 253, 0.4);
}

.btn-success {
    background-color: var(--success-color);
    box-shadow: 0 4px 6px rgba(25, 135, 84, 0.3);
}

.btn-success:hover:not(:disabled) {
    background-color: #157347;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(25, 135, 84, 0.4);
}

.btn-outline-secondary {
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline-secondary:hover {
    background-color: var(--secondary-color);
    color: #ffffff;
    transform: translateY(-2px);
}

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

/* Textarea Styling */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
    max-height: 150px;
    font-family: 'Courier New', monospace;
}

textarea.form-control:read-only {
    background-color: #f8f9fa;
    cursor: default;
}

/* Header Styling */
.display-4 {
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 2rem;
}

@media (min-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
}

.lead {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

@media (min-width: 768px) {
    .lead {
        font-size: 1.25rem;
    }
}

/* Toast Notification */
.toast {
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.toast-header {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
}

/* Info Text */
.text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem !important;
    }
    
    .lead {
        font-size: 0.875rem;
        margin-bottom: 0.5rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
    }
    
    .main-card {
        max-height: calc(100vh - 140px);
    }
    
    .card-body-scrollable {
        max-height: calc(100vh - 160px);
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .nav-pills .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    textarea.form-control {
        min-height: 70px;
        max-height: 100px;
        rows: 3;
    }
    
    small.text-muted {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }
    
    .mb-3 {
        margin-bottom: 0.75rem !important;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 576px) {
    html, body {
        height: 100vh;
        height: -webkit-fill-available;
        overflow: hidden;
        margin: 0;
        padding: 0;
    }
    
    .mobile-container {
        align-items: flex-start !important;
        padding-top: 1.5rem !important;
    }
    
    .mobile-inner-container {
        align-items: flex-start !important;
        padding-top: 1.5rem !important;
    }
    
    .container-fluid {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        padding-top: 1.5rem !important;
        padding-bottom: 0.5rem !important;
        margin: 0 !important;
    }
    
    .container-fluid.d-flex {
        align-items: flex-start !important;
        padding-top: 0 !important;
    }
    
    .container.d-flex {
        align-items: flex-start !important;
    }
    
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .col-12 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .header-section {
        margin-top: 0 !important;
        padding-top: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .display-4 {
        font-size: 1.25rem;
        margin-bottom: 0.1rem !important;
        margin-top: 0 !important;
        line-height: 1.2;
    }
    
    .lead {
        font-size: 0.75rem;
        margin-bottom: 0 !important;
        line-height: 1.3;
    }
    
    .card {
        margin: 0 !important;
        border-radius: 0.75rem;
    }
    
    .card-body {
        padding: 0.5rem !important;
    }
    
    .main-card {
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px); /* Dynamic viewport height for mobile */
    }
    
    .card-body-scrollable {
        max-height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px); /* Dynamic viewport height for mobile */
    }
    
    .btn-lg {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .nav-pills .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .nav-pills .nav-link i {
        font-size: 0.75rem;
    }
    
    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }
    
    .form-control {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    textarea.form-control {
        min-height: 60px;
        max-height: 80px;
        rows: 2;
    }
    
    small.text-muted {
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .mb-3 {
        margin-bottom: 0.5rem !important;
    }
    
    .mb-2 {
        margin-bottom: 0.25rem !important;
    }
    
    .gap-2 {
        gap: 0.4rem !important;
    }
    
    .input-group .btn {
        padding: 0.4rem 0.6rem;
    }
    
    .text-muted.small {
        font-size: 0.7rem !important;
    }
}

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

.card {
    animation: fadeIn 0.5s ease-in-out;
}

/* Focus States for Accessibility */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

.btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

/* Password Field Styling */
.input-group .btn-outline-secondary {
    border-left: 0;
    border-color: #e9ecef;
}

.input-group .form-control:focus + .btn-outline-secondary,
.input-group .btn-outline-secondary:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.input-group .form-control:focus {
    border-right: 0;
}

.input-group .form-control:focus + .btn-outline-secondary {
    border-left: 1px solid var(--primary-color);
}

small.text-muted {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.text-danger {
    color: #dc3545 !important;
}

