/* Base Container */
#arp-container {
    max-width: 99%;
    margin: 0 auto;
    padding: 5px;
    font-family: Arial, sans-serif;
}

/* Input Styles */
.arp-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.arp-input {
    font-size: 16px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

/* Button Styles */
.arp-button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 1px;
}

.arp-button {
    font-size: 18px;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease;
}

#arp-start {
    background-color: #4CAF50;
    color: white;
}

#arp-stop {
    background-color: #57bdcc;
    color: white;
}

.arp-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Add to your existing styles.css */
#arp-status-container {
    margin-top: 10px;
    width: 100%;
    position: relative;  /* Create positioning context for absolute icon */
}

.cassette-icon-wrapper {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cassette-icon-wrapper.show {
    opacity: 1;
}

/* Progress and Recording Status */
#arp-status {
    margin-top: 0px;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px;
    border-radius: 5px;
    background-color: #ffffff;
    border: 1px solid #ffffff;
    min-height: 45px;
    transition: opacity 1.0s ease;
}

#arp-status:empty {
    opacity: 0;
    display: flex;
}

.progress-with-countdown {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 0px;
    width: 100%;
    margin-bottom: 20px;
    flex-wrap: nowrap;
}

#arp-progress-container {
    flex: 1;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    min-width: 100px;
    max-width: calc(100% - 85px);
}

#arp-progress-container.recording {
    opacity: 1;
}

#arp-progress-bar {
    height: 100%;
    background-color: #cccccc;
    width: 0;
    transition: width 0.5s ease;
}

#arp-progress-container.recording #arp-progress-bar {
    background-color: #4CAF50;
}

/* Countdown Styles */
.arp-countdown {
    width: 70px;
    flex: 0 0 70px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #cccccc;
    font-family: monospace;
    white-space: nowrap;
}

.arp-countdown.recording {
    color: #4CAF50;
}

.arp-countdown.warning {
    color: #ff4444;
    animation: countdown-pulse 1s infinite;
}

/* Status Pill Styles */
.status-pill {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: background-color 0.3s ease, color 0.3s ease;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Status-specific styles */
.status-ready {
    background-color: rgba(255,255,255,0.9);
    color: #666;
    border-color: rgba(102,102,102,0.2);
}

.status-recording {
    background-color: rgba(255,59,48,0.9);
    color: white;
    border-color: rgba(255,59,48,0.6);
    animation: pulse 2s infinite;
}

.status-processing {
    background-color: rgba(255,204,0,0.9);
    color: #333;
    border-color: rgba(255,204,0,0.6);
}

.status-uploading {
    background-color: rgba(87,189,204,0.9);
    color: white;
    border-color: rgba(87,189,204,0.6);
}

/* Transcribed status style */
.status-transcribed {
    background-color: rgba(128, 0, 128, 0.9);  /* Purple color */
    color: white;
    border-color: rgba(128, 0, 128, 0.6);
}

.status-success {
    background-color: rgba(76,175,80,0.9);
    color: white;
    border-color: rgba(76,175,80,0.6);
}

.status-error {
    background-color: rgba(255,59,48,0.9);
    color: white;
    border-color: rgba(255,59,48,0.6);
}

.status-offline {
    background-color: rgba(142,142,147,0.9);
    color: white;
    border-color: rgba(142,142,147,0.6);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Mobile-specific adjustments */
@media (max-width: 480px) {
    .status-pill {
        top: 5px;
        right: 5px;
        padding: 4px 10px;
        font-size: 12px;
        max-width: 120px;
    }
}

@keyframes countdown-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Status Row and Connection Indicators */
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 3px;
    min-height: 38px;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.offline-status-banner {
    flex: 1;
    min-width: 0;
    padding: 2px 8px; /* Reduced from 0 8px - adding minimal 2px vertical padding */
    margin: 0;
    display: flex;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    height: auto; /* Remove fixed height of 38px */
    min-height: 24px; /* Set minimum height for when empty */
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.connection-icon-container {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-left: auto;
    z-index: 2;
}

.icon-online,
.icon-offline {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    background-color: transparent;
}

/* Initial state - offline icon visible by default */
.icon-offline {
    opacity: 1;  /* Make offline icon visible by default */
}

/* Active states for icons */
.connection-online .icon-online {
    opacity: 1;
}

.connection-offline .icon-offline {
    opacity: 1;
}

.icon-online svg,
.icon-offline svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    position: relative;
    right: -8px;  /* Add right offset to align with trash icon */
}

.icon-online svg {
    stroke: #4CAF50;
}

.icon-offline svg {
    stroke: #666;
}

/* Pending Records Container */
#arp-pending-container {
    margin-top: 5px;
    padding: 10px 8px;
    background-color: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#arp-pending-container h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

/* Pending Header */
.pending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

/* Retry All Button */
.retry-all-button {
    background-color: #57bdcc;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 8px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.retry-all-button:hover {
    background-color: #489dad;
}

.retry-all-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.retry-all-button::before {
    content: "↻";
    font-size: 16px;
    font-weight: bold;
}

/* Pending Recordings List */
#arp-pending-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
}

.pending-recording-item {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    position: relative;
    gap: 12px;
    width: 100%;
}

.pending-recording-item:last-child {
    border-bottom: none;
}

/* Recording Info */
.recording-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
    padding: 0 5px;
    margin-right: 40px;
    overflow: hidden;
}

.pending-name {
    font-weight: bold;
    color: #4CAF50;
    font-size: 15.4px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pending-time {
    white-space: nowrap;
    color: #666;
    font-size: 13.2px;
}

/* Clear Button Base Styles */
.clear-button {
    position: absolute;
    right: 8px;
    padding: 4px;  /* Reduced from 6px */
    margin-right: -2px;
    background: none;
    border: 2px solid #666;  /* Added border */
    border-radius: 12px;  /* Added border radius */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    color: #666;
    transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    z-index: 1;
    width: 39px;  /* Explicitly set width */
    height: 39px;  /* Explicitly set height */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);  /* Added subtle shadow */
}

/* Hover state */
.clear-button:hover {
    border-color: #333;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Disabled state */
.clear-button:disabled {    
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
    box-shadow: none;
    transform: none;
}

/* SVG Icon Size */
.clear-button svg {
    width: 31px;  /* Increased from 27px */
    height: 31px;  /* Increased from 27px */
}

/* Animation states */
.clear-button.deleting {
    border-color: transparent;  /* Hide border during deletion */
    background-color: #ffeb3b;  /* Yellow background */
    animation: button-pulse 0.8s ease-in-out;
}

.clear-button.deleting line {
    animation: blink-line 1.2s ease-in-out;
    transform-origin: center;
}

.clear-button.deleting svg {
    animation: fade-stroke 1.0s ease-in-out;
    animation-delay: 0.1s;
}

/* Animation keyframes */
@keyframes button-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes blink-line {
    0% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
    100% { transform: scaleY(1); }
}

@keyframes fade-stroke {
    0% { stroke: #666; }
    50% { stroke: #0066ff; }
    100% { stroke: #666; }
}

/* Add to your existing styles.css */
.listen-button {
    background: none;
    border: 2px solid #666;
    border-radius: 12px;
    padding: 2px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 12px;
    /* Add subtle shadow and transition */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: border-color 0.3s ease, opacity 0.3s ease;
}

.listen-button:disabled {
    opacity: 0.5;
    border-color: #ccc;
    cursor: default;
}

.listen-button:not(:disabled):hover {
    border-color: #4CAF50;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.listen-button.playing {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.05);
}

.listen-button.playing .listen-icon {
    fill: #4CAF50;
    animation: pulse 2s infinite;
}

.listen-icon {
    width: 100%;
    height: 100%;
    fill: #666;
    transition: fill 0.3s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Optional: Add hover state even though button is disabled */
.listen-button:hover {
    border-color: #999;
}

/* Spinner Animation */
.spinner {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(76, 175, 80, 0.3);
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

.spinner:after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile Styles */
@media (max-width: 480px) {           //////////////////////
    #arp-container {
        padding: 1px;
        width: 99%;
    }

    .offline-status-banner {
        padding: 0 8px; /* Slightly reduced padding for mobile */
    }

    #arp-pending-list {
        max-height: 60vh;
    }

    .progress-with-countdown {
        margin: 15px 0;
        gap: 10px;
    }

    #arp-progress-container {
        max-width: calc(100% - 65px);
    }

    .recording-info {
        font-size: 13px;
        margin-right: 35px;
        padding: 0 3px;
    }

    .arp-countdown {
        width: 55px;
        flex: 0 0 55px;
        font-size: 16px;
    }

    .status-row {
        padding: 6px 4px;
    }
    
    .connection-icon-container {
        width: 28px;
        height: 28px;
    }
    
    .icon-online svg,
    .icon-offline svg {
        width: 28px;
        height: 28px;
    }

    .offline-status-banner {
        font-size: 13px;
    }
}

/* Desktop Styles */
@media (min-width: 768px) {
    .arp-input-container {
        flex-direction: row;
    }
    
    .arp-input {
        flex: 1;
    }

    .arp-button-container {
        flex-direction: row;
    }
    
    .arp-button {
        flex: 1;
    }
    
    .button-container {
        min-width: 140px;
    }
}