/**
 * WHOIS Lookup Tool - Custom Styles
 * Lone Star Hosting
 * Extends Texas-themed branding from main.css
 */

/* Prevent horizontal scrolling on mobile */
body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Ensure containers don't overflow */
.container,
.container-fluid {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

/* Hero Section for WHOIS */
.hero-section {
    background: linear-gradient(135deg, var(--texas-blue) 0%, #1a365d 100%);
    padding: 6rem 0;
    position: relative;
    z-index: 1;
}

.hero-section h1 {
    color: white;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.1;
}

/* Search Form */
.whois-search-container {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.whois-search-form {
    width: 100%;
    box-sizing: border-box;
}

.whois-search-form .input-group {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.whois-search-form .form-control {
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: var(--border-radius-lg) 0 0 var(--border-radius-lg);
    background-color: #ffffff !important;
    color: #212529 !important; /* Dark text for visibility */
    font-weight: 500;
}

.whois-search-form .form-control::placeholder {
    color: #6c757d !important; /* Visible placeholder */
    opacity: 0.8;
}

.whois-search-form .form-control:focus {
    border-color: transparent;
    box-shadow: none;
    outline: 2px solid var(--texas-red);
    outline-offset: -2px;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.whois-search-form .form-control:focus::placeholder {
    color: #adb5bd !important;
    opacity: 0.6;
}

.whois-search-form .btn {
    border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
    padding: 1rem 2rem;
    font-weight: 600;
    transition: var(--transition-standard);
}

.whois-search-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(191, 10, 48, 0.3);
}

/* Results Section */
.whois-results-section {
    background: var(--background-light);
    min-height: 400px;
}

/* Card Header - Flexbox for domain header */
.content-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

#domainHeaderCard .card-header {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.domain-status-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.domain-status-badge .badge {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Detail Items */
.detail-item {
    padding: 0.75rem 0;
}

.detail-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.detail-value {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 500;
    word-break: break-word;
    position: relative;
    padding-right: 2.5rem;
}

.detail-value i {
    color: var(--texas-blue);
    margin-right: 0.5rem;
}

.detail-value .copyable {
    font-family: 'Inconsolata', monospace;
    color: var(--texas-blue);
}

/* Copy Button */
.btn-copy {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--texas-blue);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition-standard);
    opacity: 0.6;
}

.btn-copy:hover {
    opacity: 1;
    background: rgba(0, 40, 104, 0.1);
    color: var(--texas-red);
}

.btn-copy.copied {
    color: var(--texas-red);
    opacity: 1;
}

.btn-copy.copied i::before {
    content: "\f00c"; /* check icon */
}

/* Nameserver List */
.nameserver-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nameserver-list li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--background-light);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--texas-blue);
    font-family: 'Inconsolata', monospace;
    color: var(--texas-blue);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nameserver-list li i {
    color: var(--texas-red);
    margin-right: 0.75rem;
}

.nameserver-list li .btn-copy {
    position: static;
    transform: none;
}

/* Status List */
.status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.5rem 1rem;
    background: rgba(0, 40, 104, 0.1);
    color: var(--texas-blue);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(0, 40, 104, 0.2);
}

.status-badge.active {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.2);
}

/* DNSSEC Badge */
.dnssec-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
}

.dnssec-badge.signed {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.dnssec-badge.unsigned {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Raw Data */
.raw-data {
    background: var(--text-dark);
    color: #28a745;
    padding: 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Inconsolata', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner-container {
    text-align: center;
    color: white;
}

.loading-spinner-container .loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--texas-red);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Alert */
.alert {
    margin-top: 2rem;
    border-radius: var(--border-radius-md);
    border: none;
    box-shadow: var(--card-shadow);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 4rem;
    color: var(--texas-blue);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0 4rem;
    }
    
    .hero-section .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .hero-section .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .hero-section [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1.5rem !important;
    }
    
    .hero-section .lead {
        font-size: 1rem;
        padding: 0 0.5rem;
        margin-bottom: 2rem !important;
    }
    
    .whois-search-container {
        padding: 0 0.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
    }
    
    .whois-search-form {
        width: 100%;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }
    
    .whois-search-form .input-group {
        flex-direction: column;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
        width: 100%;
        margin: 0;
        box-sizing: border-box;
        display: flex;
    }
    
    .whois-search-form .form-control {
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
        min-height: 48px; /* Better touch target */
        background-color: #ffffff !important;
        color: #212529 !important;
        -webkit-text-fill-color: #212529 !important; /* iOS Safari fix */
        -webkit-appearance: none; /* Remove iOS default styling */
        appearance: none;
    }
    
    .whois-search-form .form-control::placeholder {
        color: #6c757d !important;
        opacity: 0.8;
    }
    
    .whois-search-form .form-control:focus {
        background-color: #ffffff !important;
        color: #212529 !important;
        -webkit-text-fill-color: #212529 !important;
    }
    
    .whois-search-form .btn {
        border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        min-height: 48px; /* Better touch target */
    }
    
    .whois-search-form .form-text {
        font-size: 0.875rem;
        padding: 0 1rem;
        margin-top: 1rem !important;
    }
    
    .whois-search-form .form-text i {
        margin-right: 0.25rem;
        margin-left: 0;
    }
    
    .whois-search-form .form-text .ms-3 {
        margin-left: 1rem !important;
    }
    
    /* Results Section */
    .whois-results-section {
        padding: 2rem 0 !important;
    }
    
    .whois-results-section .container {
        padding: 0 1rem;
    }
    
    /* Cards */
    .content-card {
        margin-bottom: 1.5rem !important;
        border-radius: var(--border-radius-md);
        overflow: hidden;
    }
    
    .content-card .card-header {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        flex-direction: column;
    }
    
    #domainHeaderCard .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .content-card .card-title {
        font-size: 1.125rem;
        line-height: 1.4;
        word-break: break-word;
        flex: 1 1 auto;
        min-width: 0; /* Allow flex shrinking */
    }
    
    .content-card .card-body {
        padding: 1rem 1.25rem;
    }
    
    /* Domain Header Card */
    .domain-status-badge {
        position: static;
        margin-top: 0.75rem;
        width: 100%;
        order: 2;
    }
    
    .domain-status-badge .badge {
        display: inline-block;
        font-size: 0.8125rem;
        padding: 0.375rem 0.75rem;
    }
    
    #domainHeaderCard .card-title {
        width: 100%;
        order: 1;
        margin-bottom: 0;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    #domainHeaderCard .card-title span {
        display: inline-block;
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Detail Items */
    .detail-item {
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .detail-item:last-child {
        border-bottom: none;
    }
    
    .detail-label {
        font-size: 0.75rem;
        margin-bottom: 0.375rem;
    }
    
    .detail-value {
        font-size: 0.9375rem;
        padding-right: 0;
        margin-bottom: 0;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .detail-value i {
        font-size: 0.875rem;
        margin-right: 0.375rem;
    }
    
    /* Copy Button on Mobile */
    .btn-copy {
        position: static;
        transform: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 0.5rem;
        min-width: 36px;
        min-height: 36px;
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Columns - Stack on Mobile */
    .col-md-4,
    .col-md-6,
    .col-md-12 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Raw Data */
    .raw-data {
        padding: 1rem;
        font-size: 0.75rem;
        line-height: 1.5;
        max-height: 400px;
        word-break: break-all;
        overflow-wrap: break-word;
    }
    
    /* Buttons */
    .btn {
        min-height: 44px; /* iOS/Android touch target minimum */
        padding: 0.625rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Action Buttons */
    #exportJsonBtn,
    #newLookupBtn {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    #exportJsonBtn {
        margin-right: 0 !important;
    }
    
    /* Nameserver List */
    .nameserver-list {
        margin: 0;
    }
    
    .nameserver-list li {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        word-break: break-word;
    }
    
    .nameserver-list li .btn-copy {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    /* Status List */
    .status-list {
        gap: 0.375rem;
    }
    
    .status-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        flex: 1 1 auto;
        min-width: 0;
        word-break: break-word;
    }
    
    /* Contact Cards */
    .contact-field {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .contact-field:last-child {
        border-bottom: none;
    }
    
    .contact-field label {
        font-size: 0.75rem;
    }
    
    .contact-field .value {
        font-size: 0.9375rem;
        word-break: break-word;
    }
    
    /* Loading Overlay */
    .loading-overlay {
        padding: 1rem;
    }
    
    .loading-spinner-container {
        padding: 2rem 1rem;
    }
    
    .loading-spinner-container p {
        font-size: 0.9375rem;
        margin-top: 1rem !important;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 !important;
    }
    
    .footer .container {
        padding: 0 1rem;
    }
    
    .footer-heading {
        font-size: 1.125rem;
    }
    
    .footer-description {
        font-size: 0.875rem;
    }
}

/* Extra Small Devices */
@media (max-width: 576px) {
    .hero-section {
        padding: 2.5rem 0 3rem;
    }
    
    .hero-section .container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    .hero-section .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .hero-section [class*="col-"] {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    .hero-section h1 {
        font-size: 1.5rem;
        padding: 0 0.5rem;
        line-height: 1.2;
    }
    
    .hero-section .lead {
        font-size: 0.9375rem;
        padding: 0 0.5rem;
        line-height: 1.5;
    }
    
    /* Ensure input field is visible on small screens */
    .whois-search-container {
        padding: 0 0.25rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .whois-search-form {
        width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    .whois-search-form .input-group {
        width: 100%;
        margin: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        box-sizing: border-box;
    }
    
    .whois-search-form .form-control {
        background-color: #ffffff !important;
        color: #212529 !important;
        -webkit-text-fill-color: #212529 !important;
        font-size: 16px; /* Prevent zoom on iOS */
        width: 100%;
        box-sizing: border-box;
    }
    
    .whois-search-form .form-control::placeholder {
        color: #6c757d !important;
        opacity: 0.8;
    }
    
    .whois-search-form .btn {
        width: 100%;
        box-sizing: border-box;
    }
    
    .content-card .card-header {
        padding: 0.875rem 1rem;
    }
    
    .content-card .card-body {
        padding: 0.875rem 1rem;
    }
    
    .card-title {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .detail-value {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .raw-data {
        font-size: 0.6875rem;
        padding: 0.75rem;
        line-height: 1.4;
    }
    
    /* Ensure no horizontal scroll */
    * {
        max-width: 100%;
    }
    
    /* Fix long URLs and text */
    a, 
    .detail-value,
    .copyable {
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Prevent table/code overflow */
    pre,
    code,
    .raw-data {
        word-break: break-all;
        overflow-wrap: break-word;
        white-space: pre-wrap;
    }
}

/* Animation */
.content-card {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print Styles */
@media print {
    .navbar,
    .whois-search-container,
    .loading-overlay,
    .btn,
    .footer {
        display: none !important;
    }
    
    .whois-results-section {
        display: block !important;
    }
}

