/* Details page styles */

/* Common utility classes */
.full-width { width: 100%; max-width: 100%; }
.box-border { box-sizing: border-box; }
.no-wrap { white-space: nowrap; }
.text-center { text-align: center; }
.overflow-hidden { overflow: hidden; }

/* Layout and page structure */
.details-page {
    word-wrap: break-word;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* Force stable layout immediately */
.details-page.container-fluid {
    padding: 0 15px;
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
}

.details-content-wrapper {
    display: flex;
    flex-wrap: nowrap;
    margin: 0 -15px;
    width: calc(100% + 30px);
    min-height: 200px;
    align-items: flex-start;
}

.main {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 360px);
    overflow-x: auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.main > * {
    max-width: 100%;
    box-sizing: border-box;
}

.sidepanel {
    flex: 0 0 330px;
    width: 330px;
    min-height: 200px;
    box-sizing: border-box;
}

/* Responsive layout for smaller screens */
@media (max-width: 768px) {
    .details-page {
        max-width: 100%;
        margin: 0 auto;
        padding: 0;
    }
    
    .details-page.container-fluid {
        max-width: 100%;
    }
    
    .details-content-wrapper {
        flex-direction: column;
        margin-right: 0;
        margin-left: 0;
        width: 100%;
    }
    
    .main {
        flex: 1 1 auto !important; /* Override the fixed flex settings */
        width: 100% !important;
        max-width: 100% !important;
        padding-right: 0;
        padding-left: 0;
        margin-bottom: 15px;
        order: 1; /* Ensure it comes before sidebar */
    }
    
    .sidepanel {
        flex: 1 1 auto !important; /* Override the fixed flex settings */
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        padding-right: 0;
        padding-left: 0;
        flex-basis: auto !important;
        order: 2; /* Ensure it comes after main content */
    }
    
    /* Mobile tab improvements */
    .details-tabs .nav-tabs {
        font-size: 13px;
    }
    
    .details-tabs .nav-tabs > li {
        margin-bottom: 1px;
    }
    
    .details-tabs .nav-tabs > li > a {
        padding: 6px 8px;
    }
    
    /* Make action items stack cleanly */
    .details-tabs .nav-tabs > li.pull-right {
        float: none;
        margin-top: 3px;
    }
    
    /* Mobile table improvements */
    .dltable-clean {
        font-size: 8px;
        width: 100%;
        margin: 0;
    }
    
    .details-info-table {
        width: 100%;
        margin: 0;
    }
    
    .details-info-table td:first-child {
        width: 120px;
    }
    
    /* Ensure all tables fit on mobile */
    .table-scroll-container {
        margin: 0;
        padding: 0;
    }
    
    /* Collections table mobile adjustments */
    #collections .table {
        font-size: 11px;
    }
    
    #collections .colhead,
    #collections .table td {
        padding: 4px;
    }
}

.details-footer {
    margin-top: 20px;
    padding: 10px;
    text-align: center;
}

/* Alert close button */
.alert-close-btn {
    float: right;
}

/* Statistics alert */
.stats-alert {
    padding-bottom: 0px;
    font-size: small;
}

.stats-table {
    background: white;
}

/* Global table styles */
.details-page table:not(#collections .table),
.details-page .table:not(#collections .table),
.details-info-table,
.file-list-table,
.dltable-clean {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    table-layout: fixed;
}

.details-page .table { margin-bottom: 0; }
.details-page .table-responsive,
.table-scroll-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* World map container */
#world-map-markers {
    width: 100%;
    max-width: 100%; /* Prevent map from exceeding container */
    height: 300px;
    box-sizing: border-box;
    background-color: rgb(56, 63, 71);
    /* Ensure stable dimensions for jvectormap */
    min-width: 200px; /* Minimum reasonable map width */
    position: relative;
}

/* Prevent vector map from breaking layout */
.jvectormap-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    background-color: rgb(56, 63, 71);
    /* Force correct initial sizing */
    position: relative !important;
    overflow: hidden !important;
}

/* Ensure jvectormap loading area has correct background */
.jvectormap-loading {
    background-color: rgb(56, 63, 71) !important;
}

/* Info table styling */
.details-info-table {
    font-size: small;
    width: 100%;
    max-width: 100%; /* Prevent table from exceeding container */
    border: 1px solid #ddd;
    table-layout: fixed; /* Prevent table from expanding beyond container */
    box-sizing: border-box;
}

.details-info-table th {
    text-align: center;
    padding: 8px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
}

.details-info-table td {
    padding: 8px;
    border: 1px solid #ddd;
    vertical-align: top;
}

/* Tight width for the left column (labels) */
.details-info-table td:first-child {
    width: 140px;
    white-space: nowrap;
    text-align: right;
    font-weight: bold;
    padding: 8px 12px 8px 8px;
}

/* File list styling */
.file-list-header {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-list-header .title {
    font-weight: bold;
}

.file-list-header .toggle-link {
    font-size: 90%;
}

.file-list-table {
    font-size: 10pt;
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    box-sizing: border-box;
}

.file-list-table td.filename {
    word-break: break-word;
}

.file-list-table th {
    text-align: center;
    padding: 6px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
}

.file-list-table td {
    padding: 6px;
    border: 1px solid #ddd;
    vertical-align: top;
}

/* Star rating styles */
.star-icon {
    font-size: 1.2em;
}

.star-icon.gold {
    color: gold;
}

.star-badge {
    float: right;
    margin-left: 2px;
}

/* Alert and notification styles */
.no-seeds-alert {
    text-align: center;
    margin-top: 10pt;
}

.no-seeds-icon {
    font-size: 5.2em;
}

.dmca-alert {
    margin-bottom: 0px;
}

.dmca-icon {
    font-size: 5.2em;
}

.noseeds-alert {
    text-align: center;
    margin-top: 10pt;
}

.noseeds-icon {
    font-size: 5.2em;
}

/* Panel styles */
.details-panel-border {
    border-style: solid;
    padding-bottom: 0px;
}

.details-panel-nowrap {
    white-space: nowrap;
}

.download-button {
    padding: 10px;
    width: 100%;
}

/* Accept terms button */
#acceptterms {
    display: none;
    white-space: nowrap;
}

/* Vector map zoom buttons */
#worldmap_zoom_in, #worldmap_zoom_out {
    background-color: #EEEEEE;
    color: black;
    border: 1px solid #CCCCCC;
    height: 15px;
    width: 15px;
}

/* Home tab styles */
.home-file-panel {
    overflow-y: scroll;
    overflow-x: hidden;
}

.home-file-panel.multi-file {
    height: 280px;
}

.home-file-table {
    font-size: 10pt;
    margin: 0px;
}

.home-filename-cell {
    word-break: break-word;
}

.home-description {
    padding: 5px;
}

.home-tags-container {
    margin-left: 8px;
}

.home-tag {
    display: inline-block;
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 3px 8px;
    margin: 2px;
    border-radius: 12px;
    font-size: 11px;
}

.home-tag-link {
    text-decoration: none;
    color: #0066cc;
}

.home-bibtex-container {
    padding: 3px;
}

.home-bibtex {
    font-size: x-small;
    white-space: pre-wrap;
    margin: 0px;
}

/* Comment styles */
.comment-meta {
    font-size: small;
    margin: 0;
    color: grey;
}

.comment-avatar-cell {
    width: 30px;
    padding: 1px;
}

.comment-edit-info {
    font-size: small;
}

/* Collections table styles */
#collections .table {
    font-size: small;
    width: 100%;
}

/* Title styles */
.title-container {
    padding: 0px;
}

.title-category-icon {
    font-size: 3em;
    float: left;
    padding-top: 0px;
    padding-right: 30px;
}

.title-banned-icon {
    color: red;
}

/* Map tooltip styles */
.map-tooltip {
    min-width: 200px;
}

.map-tooltip-avatar {
    float: left;
    padding: 5px;
}

/* dltable styles - compact peer/torrent tables */
.dltable-clean {
    width: 100%;
    max-width: 100%; /* Ensure it doesn't exceed container */
    font-size: 10px;
    border-collapse: collapse;
    background-color: #fff;
    table-layout: fixed; /* Prevents layout shifts */
    box-sizing: border-box; /* Include borders in width calculation */
}

.dltable-clean thead {
    background-color: #343a40;
    color: white;
}

.dltable-clean th {
    padding: 3px 2px;
    text-align: center;
    border: 1px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
    font-size: 9px;
}

.dltable-clean th:first-child,
.dltable-clean th:nth-child(2) {
    text-align: left;
}

.dltable-clean td {
    padding: 2px 3px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
    font-size: 9px;
    line-height: 1.1;
    overflow: hidden; /* Prevents content from breaking layout */
}

/* Tight padding for avatar column */
.dltable-clean td:first-child {
    padding: 1px 2px;
    text-align: center;
}

.dltable-clean tbody tr:hover {
    background-color: #f8f9fa;
}

.dltable-clean tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.dltable-clean .user-cell {
    width: 130px; /* Reduced for tighter fit */
    line-height: 1.0;
}

.dltable-clean .location-text {
    font-size: 8px;
    color: #6c757d;
    display: block;
    margin-top: 1px;
    line-height: 1.0;
}

/* dltable utility classes */
.dltable-clean .text-center { text-align: center; }
.dltable-clean .text-nowrap { white-space: nowrap; }
.dltable-clean .ratio-good { color: #28a745; }
.dltable-clean .ratio-bad { color: #dc3545; }
.dltable-clean .connectable-no { color: #dc3545; font-weight: bold; }
.dltable-clean .connectable-yes { color: #28a745; }

.dltable-clean .gravatar { 
    border-radius: 2px; 
    margin-right: 2px; 
    vertical-align: middle;
    max-width: 24px;
    max-height: 24px;
}

.dltable-clean .username-link { 
    font-weight: bold; 
    text-decoration: none; 
}

.dltable-clean .ip-link { 
    color: #6c757d; 
    font-size: 8px; 
}

.dltable-clean .progress-cell {
    position: relative;
    width: 50px;
    font-size: 8px;
}

.dltable-clean .compact-user {
    line-height: 1.0;
}

.dltable-clean .compact-user .username-line {
    font-size: 9px;
    font-weight: bold;
}

.dltable-clean .compact-user .ip-line {
    font-size: 8px;
    color: #6c757d;
}

.dltable-clean .client-cell {
    width: 70px; /* Reduced for tighter fit */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 8px;
    padding: 2px 3px;
}

/* dltable column widths */
.dltable-clean .avatar-col { width: 26px; padding: 1px 2px; }
.dltable-clean .conn-col { width: 30px; }
.dltable-clean .size-col { width: 50px; }
.dltable-clean .rate-col { width: 55px; }
.dltable-clean .ratio-col { width: 40px; }
.dltable-clean .time-col { width: 50px; }
